dot-emacs: Finally fix fontification in cpp-messages-mode.
[profile] / dot-emacs.el
index 66f9190..9899ef9 100644 (file)
        ,(if (cdr forms) (cons 'progn forms) (car forms))
      (error (message "Error (trapped): %s" (error-message-string err)))))
 
+;; --- Configuration reading ---
+
+(defvar mdw-config nil)
+(defun mdw-config (sym)
+  "Read the configuration variable named SYM."
+  (unless mdw-config
+    (setq mdw-config (with-temp-buffer
+                      (insert-file-contents "~/.mdw.conf")
+                      (replace-regexp "^[ \t]*\\(#.*\\|\\)\n" ""
+                                      nil (point-min) (point-max))
+                      (replace-regexp (concat "^[ \t]*"
+                                              "\\([-a-zA-Z0-9_.]*\\)"
+                                              "[ \t]*=[ \t]*"
+                                              "\\(.*[^ \t\n]\\|\\)"
+                                              "[ \t]**\\(\n\\|$\\)")
+                                      "(\\1 . \"\\2\") "
+                                      nil (point-min) (point-max))
+                      (car (read-from-string
+                            (concat "(" (buffer-string) ")"))))))
+  (cdr (assq sym mdw-config)))
+
 ;; --- Splitting windows ---
 
 (defconst mdw-scrollbar-width (if window-system 6 1)
@@ -1010,7 +1031,7 @@ strip numbers instead."
                        "del" "elif" "else" "except" "exec" "finally" "for"
                        "from" "global" "if" "import" "in" "is" "lambda"
                        "not" "or" "pass" "print" "raise" "return" "try"
-                       "while"))))
+                       "while" "yield"))))
     (setq font-lock-keywords
          (list
           't
@@ -1550,12 +1571,11 @@ strip numbers instead."
                                      "\\)\\>\\|[0-9]+\\|$\\)\\)")
                              '(1 font-lock-keyword-face)))
                  message-mode-keywords)))
-  (setq font-lock-defaults
-       '(message-mode-keywords nil nil nil nil))
   (turn-on-font-lock-if-enabled)
-  (run-hooks 'messages-mode-hook))
+  (run-hooks 'cpp-messages-mode-hook))
 
-(add-hook 'messages-file-hook 'mdw-misc-mode-config t)
+(add-hook 'messages-mode-hook 'mdw-misc-mode-config t)
+(add-hook 'cpp-messages-mode-hook 'mdw-misc-mode-config t)
 ; (add-hook 'messages-file-hook 'mdw-fontify-messages t)
 
 ;;;----- Messages-file mode -------------------------------------------------
@@ -1729,7 +1749,7 @@ strip numbers instead."
            'comint-watch-for-password-prompt))
 
 (defun mdw-term-mode-setup ()
-  (setq term-prompt-regexp "^[^]#$%>»\n]*[]#$%>»] *")
+  (setq term-prompt-regexp "^[^]#$%>»}\n]*[]#$%>»}] *")
   (make-local-variable 'mouse-yank-at-point)
   (make-local-variable 'transient-mark-mode)
   (setq mouse-yank-at-point t)