Instead of doing something useful I spent the first part of the day coaxing/cargo-culting emacs to fontify user-definied defoo forms nicely.
In case someone else is was annoyed by the this lack of angry-fruit-saladness, here goes (eg. add this to lisp-mode-hook):
;; Fontification for user-defined defoo macros (font-lock-add-keywords 'lisp-mode '(("(\(def.*?\)\>[ '(]*\(setf[ ]+\sw+)\|\sw+\)?" (1 font-lock-keyword-face) (2 (let ((name (match-string 2))) (when name (cond ((string-match "^\*" name) font-lock-variable-name-face) ((string-match "^\+" name) font-lock-constant-name-face) (t font-lock-function-name-face))))))) t)
Won't take effect without restarting emacs -- or some other trickery that I'm not aware of.
Cheers,
-- Nikodemus
Nikodemus Siivola wrote:
Instead of doing something useful I spent the first part of the day coaxing/cargo-culting emacs to fontify user-definied defoo forms nicely.
[...] code.
Won't take effect without restarting emacs -- or some other trickery that I'm not aware of.
Just rerunning M-x lisp-mode RET should do the trick.
The way to really do this is to push these keywords onto a new font-lock-keywords variable, like:
(defvar lisp-font-lock-keywords-3 (append lisp-font-lock-keywords-2 list-as-above))
Then, if users have font-lock-maximum-decoration set to either t, or 3, these extra keywords will be picked up, otherwise they won't.
[...]