el/dot-emacs.el (mdw-examine-fill-prefixes): Rewrite to be iterative.
[profile] / el / dot-emacs.el
index 8ca49a5..5bde809 100644 (file)
@@ -588,6 +588,9 @@ Even if an existing window in some random frame looks tempting."
 Pretend they don't exist.  They might be on other display devices."
   (ad-set-arg 2 nil))
 
+(setq even-window-sizes nil
+      even-window-heights nil)
+
 ;; Rename buffers along with files.
 
 (defvar mdw-inhibit-rename-buffer nil
@@ -1224,17 +1227,6 @@ This is mainly useful in `auto-fill-mode'.")
          (funcall tabfun (point-min) (point-max))
          (setq s (buffer-substring (point-min) (1- (point-max)))))))))
 
-(defun mdw-examine-fill-prefixes (l)
-  "Given a list of dynamic fill prefixes, pick one which matches
-context and return the static fill prefix to use.  Point must be
-at the start of a line, and match data must be saved."
-  (cond ((not l) nil)
-       ((looking-at (car (car l)))
-        (mdw-maybe-tabify (apply #'concat
-                                 (mapcar #'mdw-do-prefix-match
-                                         (cdr (car l))))))
-       (t (mdw-examine-fill-prefixes (cdr l)))))
-
 (defun mdw-maybe-car (p)
   "If P is a pair, return (car P), otherwise just return P."
   (if (consp p) (car p) p))
@@ -1258,6 +1250,22 @@ See `mdw-fill-prefix' for details."
        ((eq (car m) 'eval) (eval (cdr m)))
        (t "")))
 
+(defun mdw-examine-fill-prefixes (l)
+  "Given a list of dynamic fill prefixes, pick one which matches
+context and return the static fill prefix to use.  Point must be
+at the start of a line, and match data must be saved."
+  (let ((prefix nil))
+    (while (cond ((null l) nil)
+                ((looking-at (caar l))
+                 (setq prefix
+                         (mdw-maybe-tabify
+                          (apply #'concat
+                                 (mapcar #'mdw-do-prefix-match
+                                         (cdr (car l))))))
+                 nil))
+      (setq l (cdr l)))
+    prefix))
+
 (defun mdw-choose-dynamic-fill-prefix ()
   "Work out the dynamic fill prefix based on the variable `mdw-fill-prefix'."
   (cond ((and fill-prefix (not (string= fill-prefix ""))) fill-prefix)
@@ -1330,6 +1338,7 @@ case."
   (setq comment-column 40)
   (auto-fill-mode 1)
   (setq fill-column mdw-text-width)
+  (flyspell-prog-mode)
   (and (fboundp 'gtags-mode)
        (gtags-mode))
   (if (fboundp 'hs-minor-mode)
@@ -1661,6 +1670,10 @@ doesn't match any of the regular expressions in
 (mdw-define-face gnus-cite-11
   (t :foreground "grey"))
 
+(mdw-define-face gnus-emphasis-underline
+  (((type tty)) :underline t)
+  (t :slant italic))
+
 (mdw-define-face diff-header
   (t nil))
 (mdw-define-face diff-index
@@ -2001,12 +2014,11 @@ set."
         (func (intern (concat "mdw-define-c-style/" name-string))))
     `(progn
        (setq ,var
-            ',(if (null parent)
-                  assocs
-                (let ((parent-list (symbol-value
-                                    (intern (concat "mdw-c-style/"
-                                                    (symbol-name parent))))))
-                  (mdw-merge-style-alists assocs parent-list))))
+            ,(if (null parent)
+                 `',assocs
+               (let ((parent-list (intern (concat "mdw-c-style/"
+                                                  (symbol-name parent)))))
+                 `(mdw-merge-style-alists ',assocs ,parent-list))))
        (defun ,func () (c-add-style ,name-string ,var))
        (and (featurep 'cc-mode) (,func))
        (add-hook 'mdw-define-c-styles-hook ',func)
@@ -4538,15 +4550,16 @@ there is sadness."
     (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 ":")))
+        (preloads (and old-preload
+                       (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))))
+    (save-match-data
+      (while preloads
+       (let ((item (pop preloads)))
+         (if (string-match  "\\(/\\|^\\)noip\.so\\(:\\|$\\)" item)
+             (setq any t)
+           (push item filtered)))))
     (if any
        (unwind-protect
            (progn