Skip to content

Instantly share code, notes, and snippets.

@CarlOlson
Created February 2, 2016 05:09
Show Gist options
  • Save CarlOlson/dbb19bbe048d9e819697 to your computer and use it in GitHub Desktop.
Save CarlOlson/dbb19bbe048d9e819697 to your computer and use it in GitHub Desktop.
(require 'cl-lib)
(define-minor-mode lambda-mode
"A minor mode to help type lambda terms. Turns abbreviations
of the form \\lx into λx, with x being any letter."
nil " λ" (make-sparse-keymap)
(abbrev-mode (if lambda-mode 1 -1))
(setq save-abbrevs nil))
(define-abbrev-table 'lambda-mode-abbrev-table
(cl-loop for c from ?a to ?z
collecting (list (string ?\\ ?l c) (string ?λ c)))
"Abbreviation table for `lambda-mode'"
:regexp "\\(\\\\l[a-z]\\)")
(setq abbrev-minor-mode-table-alist
`(,@abbrev-minor-mode-table-alist
(lambda-mode . ,lambda-mode-abbrev-table)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment