(add-hook 'emacs-lisp-mode-hook 'my-elisp-hook) (defun my-elisp-hook () (setq comment-column 0) (setq lisp-font-lock-keywords trey-lisp-font-lock-keywords) ) (defvar trey-lisp-font-lock-keywords-1 (list ;; Anything not a variable or type declaration is fontified as a function. ;; It would be cleaner to allow preceding whitespace, but it would also be ;; about five times slower. (list (concat "(\\^([ ]*def\\(" ;; Variable declarations. "\\(const\\(\\|ant\\)\\|ine-key\\(\\|-after\\)\\|var\\|custom\\)\\|" ;; Structure declarations. "\\(class\\|struct\\|type\\)\\|" ;; Everything else is a function declaration. "\\([^ \t\n\(\)]+\\)" "\\)\\)\\>" ;; Any whitespace and declared object. "[ \t'\(]*" "\\([^ \t\n\)]+\\)?") '(1 font-lock-keyword-face) '(8 (cond ((match-beginning 3) 'font-lock-variable-name-face) ((match-beginning 6) 'font-lock-type-face) (t 'font-lock-function-name-face)) nil t)) ) "Subdued level highlighting Lisp modes.") (defvar trey-lisp-font-lock-keywords (append trey-lisp-font-lock-keywords-1 (list ;; ;; Control structures. ELisp and CLisp combined. ;; (cons (concat "(\\(" ;; beginning of generated stuff ;; to regenerate, use the regexp-opt below, then delete the outermost ;; grouping, then use the macro below to break up the string. ;; (regexp-opt ;; '("cond" "if" "while" "let" "let*" "prog" "progn" "prog1" ;; "prog2" "progv" "catch" "throw" "save-restriction" ;; "save-excursion" "save-window-excursion" ;; "save-current-buffer" "with-current-buffer" ;; "save-selected-window" "with-selected-window" ;; "save-selected-frame" "with-selected-frame" ;; "with-temp-file" "with-temp-buffer" "with-output-to-string" ;; "with-string-as-buffer-contents" ;; "save-match-data" "unwind-protect" "call-with-condition-handler" ;; "condition-case" "track-mouse" "autoload" ;; "eval-after-load" "eval-and-compile" "eval-when-compile" ;; "when" "unless" "do" "dolist" "dotimes" "flet" "labels" ;; "lambda" "block" "return" "return-from" "loop") t) ;; (setq last-kbd-macro ;; (read-kbd-macro "\" C-7 C-1 C-r \\\\| 3* \" RET")) "autoload\\|block\\|c\\(?:a\\(?:ll-with-condition-handler\\|tch\\)\\|" "ond\\(?:ition-case\\)?\\)\\|do\\(?:list\\|times\\)?\\|" "eval-\\(?:a\\(?:fter-load\\|nd-compile\\)\\|when-compile\\)\\|flet\\|" "if\\|l\\(?:a\\(?:bels\\|mbda\\)\\|et\\*?\\|oop\\)\\|prog[12nv]?\\|" "return\\(?:-from\\)?\\|save-\\(?:current-buffer\\|excursion\\|" "match-data\\|restriction\\|selected-\\(?:frame\\|window\\)\\|" "window-excursion\\)\\|t\\(?:hrow\\|rack-mouse\\)\\|un\\(?:less\\|" "wind-protect\\)\\|w\\(?:h\\(?:en\\|ile\\)\\|ith-\\(?:current-buffer\\|" "output-to-string\\|s\\(?:elected-\\(?:frame\\|window\\)\\|" "tring-as-buffer-contents\\)\\|temp-\\(?:buffer\\|file\\)\\)\\)" ;; end of generated stuff "\\)\\>") 1) ;; ;; Feature symbols as references. '("(\\(featurep\\|provide\\|require\\)\\>[ \t']*\\(\\sw+\\)?" (1 font-lock-keyword-face) (2 font-lock-reference-face nil t)) ;; ;; Words inside \\[] tend to be for `substitute-command-keys'. '("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-reference-face prepend) ;; ;; Words inside `' tend to be symbol names. '("`\\(\\sw\\sw+\\)'" 1 font-lock-reference-face prepend) ;; ;; CLisp `:' keywords as references. '("\\<:\\sw+\\>" 0 font-lock-reference-face prepend) ;; ;; ELisp and CLisp `&' keywords as types. '("\\<\\&\\(optional\\|rest\\|whole\\)\\>" . font-lock-type-face) )) "Gaudy level highlighting for Lisp modes. Redefined by Trey")