Skip to content

Instantly share code, notes, and snippets.

Last active May 27, 2016 21:05
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
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