dot/emacs, el/dot-emacs.el: Support for Dylan code.
[profile] / el / dot-emacs.el
index 497318a..4f9bd59 100644 (file)
@@ -757,7 +757,7 @@ case."
   (and (fboundp 'gtags-mode)
        (gtags-mode))
   (if (fboundp 'hs-minor-mode)
-      (hs-minor-mode t)
+      (trap (hs-minor-mode t))
     (outline-minor-mode t))
   (reveal-mode t)
   (trap (turn-on-font-lock)))
@@ -916,6 +916,7 @@ doesn't match any of the regular expressions in
 (mdw-define-face font-lock-string-face
   (((class mono)) :weight bold)
   (((class color)) :foreground "SkyBlue1"))
+
 (mdw-define-face message-separator
   (t :background "red" :foreground "white" :weight bold))
 (mdw-define-face message-cited-text
@@ -966,6 +967,10 @@ doesn't match any of the regular expressions in
   (((class color) (type x)) :background "RoyalBlue4")
   (t :underline t))
 
+(mdw-define-face dylan-header-background
+  (((class color) (type x)) :background "NavyBlue")
+  (t :background "blue"))
+
 (mdw-define-face magit-diff-add
   (t :foreground "green"))
 (mdw-define-face magit-diff-del
@@ -974,6 +979,9 @@ doesn't match any of the regular expressions in
   (t :weight bold))
 (mdw-define-face magit-diff-hunk-header
   (t :foreground "SkyBlue1"))
+(mdw-define-face magit-item-highlight
+  (((type tty)) :background "blue")
+  (t :background "DarkSeaGreen4"))
 
 (mdw-define-face erc-input-face
   (t :foreground "red"))
@@ -1420,17 +1428,17 @@ doesn't match any of the regular expressions in
          (list
 
           ;; Handle the keywords defined above.
-          (list (concat "\\<\\(" javascript-keywords "\\)\\>")
+          (list (concat "\\_<\\(" javascript-keywords "\\)\\_>")
                 '(0 font-lock-keyword-face))
 
           ;; Handle the predefined constants defined above.
-          (list (concat "\\<\\(" javascript-constants "\\)\\>")
+          (list (concat "\\_<\\(" javascript-constants "\\)\\_>")
                 '(0 font-lock-variable-name-face))
 
           ;; Handle numbers too.
           ;;
           ;; The following isn't quite right, but it's close enough.
-          (list (concat "\\<\\("
+          (list (concat "\\_<\\("
                         "0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|"
                         "[0-9]+\\(\\.[0-9]*\\|\\)"
                         "\\([eE]\\([-+]\\|\\)[0-9]+\\|\\)\\)"
@@ -1861,9 +1869,9 @@ strip numbers instead."
 
         ;; And anything else is punctuation.
         (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
-              '(0 mdw-punct-face)))
+              '(0 mdw-punct-face))))
 
-  (mdw-post-config-mode-hack))
+  (mdw-post-config-mode-hack)
   (run-hooks 'arm-assembler-mode-hook))
 
 ;;;--------------------------------------------------------------------------
@@ -1893,6 +1901,74 @@ strip numbers instead."
   (mdw-post-config-mode-hack))
 
 ;;;--------------------------------------------------------------------------
+;;; Dylan programming configuration.
+
+(defun mdw-fontify-dylan ()
+
+  (make-local-variable 'font-lock-keywords)
+
+  ;; Horrors.  `dylan-mode' sets the `major-mode' name after calling this
+  ;; hook, which undoes all of our configuration.
+  (setq major-mode 'dylan-mode)
+  (font-lock-set-defaults)
+
+  (let* ((word "[-_a-zA-Z!*@<>$%]+")
+        (dylan-keywords (mdw-regexps
+
+                         "C-address" "C-callable-wrapper" "C-function"
+                         "C-mapped-subtype" "C-pointer-type" "C-struct"
+                         "C-subtype" "C-union" "C-variable"
+
+                         "above" "abstract" "afterwards" "all"
+                         "begin" "below" "block" "by"
+                         "case" "class" "cleanup" "constant" "create"
+                         "define" "domain"
+                         "else" "elseif" "end" "exception" "export"
+                         "finally" "for" "from" "function"
+                         "generic"
+                         "handler"
+                         "if" "in" "instance" "interface" "iterate"
+                         "keyed-by"
+                         "let" "library" "local"
+                         "macro" "method" "module"
+                         "otherwise"
+                         "profiling"
+                         "select" "slot" "subclass"
+                         "table" "then" "to"
+                         "unless" "until" "use"
+                         "variable" "virtual"
+                         "when" "while"))
+        (sharp-keywords (mdw-regexps
+                         "all-keys" "key" "next" "rest" "include"
+                         "t" "f")))
+    (setq font-lock-keywords
+         (list (list (concat "\\<\\(" dylan-keywords
+                             "\\|" (concat "with\\(out\\)?-" word)
+                             "\\|" (concat word ":")
+                             "\\)\\>")
+                     '(0 font-lock-keyword-face))
+               (list (concat "#\\(" sharp-keywords "\\)\\>")
+                     '(0 font-lock-variable-name-face))
+               (list (concat "\\("
+                             "\\([-+]\\|\\<\\)[0-9]+" "\\("
+                               "\\(\\.[0-9]+\\)?" "\\([eE][-+][0-9]+\\)?"
+                               "\\|" "/[0-9]+"
+                             "\\)"
+                             "\\|" "\\.[0-9]+" "\\([eE][-+][0-9]+\\)?"
+                             "\\|" "#b[01]+"
+                             "\\|" "#o[0-7]+"
+                             "\\|" "#x[0-9a-zA-Z]+"
+                             "\\)\\>")
+                     '(0 mdw-number-face))
+               (list (concat "\\("
+                             "\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\|"
+                             "\\_<[-+*/=<>:&|]+\\_>"
+                             "\\)")
+                     '(0 mdw-punct-face)))))
+
+  (mdw-post-config-mode-hack))
+
+;;;--------------------------------------------------------------------------
 ;;; REXX configuration.
 
 (defun mdw-rexx-electric-* ()