el/dot-emacs.el: Remove `noip' from `LD_PRELOAD' list while running `man'.
[profile] / el / dot-emacs.el
index 68a4d9f..5bba5d7 100644 (file)
@@ -404,6 +404,8 @@ as output rather than a string."
   (let ((mdw-diary-for-org-mode-p t))
     ad-do-it))
 
+(defvar diary-time-regexp nil)
+
 (defadvice diary-add-to-list (before mdw-trim-leading-space compile activate)
   "Trim leading space from the diary entry string."
   (save-match-data
@@ -1398,6 +1400,10 @@ doesn't match any of the regular expressions in
   (((type w32)) :family "courier new" :height 85)
   (((type x)) :family "6x13" :foundry "trad" :height 130)
   (t :foreground "white" :background "black"))
+(mdw-define-face fixed-pitch-serif
+  (((type w32)) :family "courier new" :height 85 :weight bold)
+  (((type x)) :family "6x13" :foundry "trad" :height 130 :weight bold)
+  (t :foreground "white" :background "black" :weight bold))
 (if (mdw-emacs-version-p 23)
     (mdw-define-face variable-pitch
       (((type x)) :family "sans" :height 100))
@@ -1452,6 +1458,10 @@ doesn't match any of the regular expressions in
 (mdw-define-face comint-highlight-input
   (t nil))
 
+(mdw-define-face Man-underline
+  (((type tty)) :underline t)
+  (t :slant italic))
+
 (mdw-define-face ido-subdir
   (t :foreground "cyan" :weight bold))
 
@@ -4431,6 +4441,41 @@ there is sadness."
   (set-window-dedicated-p (or window (selected-window)) nil))
 
 ;;;--------------------------------------------------------------------------
+;;; Man pages.
+
+;; Turn off `noip' when running `man': it interferes with `man-db''s own
+;; seccomp(2)-based sandboxing, which is (in this case, at least) strictly
+;; better.
+(defadvice Man-getpage-in-background
+    (around mdw-inhibit-noip (topic) compile activate)
+  "Inhibit the `noip' preload hack when invoking `man'."
+  (let* ((old-preload (getenv "LD_PRELOAD"))
+        (preloads (save-match-data (split-string old-preload ":")))
+        (any nil)
+        (filtered nil))
+    (while preloads
+      (let ((item (pop preloads)))
+       (if (save-match-data
+             (string-match  "\\(/\\|^\\)noip\.so\\(:\\|$\\)" item))
+           (setq any t)
+         (push item filtered))))
+    (if any
+       (unwind-protect
+           (progn
+             (setenv "LD_PRELOAD"
+                     (and filtered
+                          (with-output-to-string
+                            (setq filtered (nreverse filtered))
+                            (let ((first t))
+                              (while filtered
+                                (if first (setq first nil)
+                                  (write-char ?:))
+                                (write-string (pop filtered)))))))
+             ad-do-it)
+         (setenv "LD_PRELOAD" old-preload))
+      ad-do-it)))
+
+;;;--------------------------------------------------------------------------
 ;;; MPC configuration.
 
 (eval-when-compile (trap (require 'mpc)))