Created
February 2, 2016 05:09
-
-
Save CarlOlson/dbb19bbe048d9e819697 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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