Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pretty lambda/nil for Emacs
;; This function is quoted from this page. Thanks to Tomohiro Matsuyama.
(defun set-pretty-patterns (patterns)
(loop for (glyph . pairs) in patterns do
(loop for (regexp . major-modes) in pairs do
(loop for major-mode in major-modes do
(let ((major-mode (intern (concat (symbol-name major-mode) "-mode")))
(n (if (string-match "\\\\([^?]" regexp) 1 0)))
(font-lock-add-keywords major-mode
`((,regexp (0 (prog1 ()
(compose-region (match-beginning ,n)
(match-end ,n)
'(( ("\\<lambda\\>" lisp lisp-interaction emacs-lisp scheme))
( ("\\<nil\\>" lisp lisp-interaction emacs-lisp scheme))
( ("\\<function\\>" js2))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.