Re: Unicode lambda revisited
Vladimir Nikishkin 17 Aug 2021 04:26 UTC
In addition to the code snippet from Arthur, I can suggest the
following:
#+begin_src elisp
(defvar lockywolf/common-mathematical-prettify-alist
(list '("<=" . ?≤)
'(">=" . ?≥))
"Lockywolf's custom prettification list.")
(add-hook 'scheme-mode-hook
(lambda ()
(setq prettify-symbols-alist
(seq-concatenate 'list
(list '("define" . ?≝)
'("set!" . ?≐)
'("set-car!" . ?≔)
'("set-cdr!" . ?≕)
'("#t" . ?✓)
'("#f" . ?✗)
'("'()" . ?∅)
'("if" . ?⁇)
'("or" . ?∨)
'("and" . ?∧))
lockywolf/common-mathematical-prettify-alist
prettify-symbols-alist))
))
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(setq prettify-symbols-alist
(seq-concatenate 'list
(list '("defun" . ?≝)
'("set" . ?≔)
'("setf" . ?≕)
'("setq" . ?≐)
'("t" . ?✓)
'("nil" . ?⦰)
'("'()" . ?∅)
'("if" . ?⁇)
'("or" . ?∨)
'("and" . ?∧))
lockywolf/common-mathematical-prettify-alist
prettify-symbols-alist))
))
(use-package prettify-greek
:ensure t
:demand t)
(global-prettify-symbols-mode 1)
(setq prettify-symbols-unprettify-at-point t)
(add-hook 'prog-mode-hook
(lambda ()
(setq prettify-symbols-alist
(seq-concatenate 'list
prettify-symbols-alist
prettify-greek-upper
prettify-greek-lower))))
#+end_src
You can check if it is readable for you by, for example:
#+begin_src
;;;; check prettification
(lambda (a b)
(or (+ a b)
(if nil t '())))
#+end_src
This list is unfinished, I would generally like to have a way to:
1. Quickly distinguish primitive forms from derived.
2. Quickly distinguish procedures from syntax.
But (1) would require reading a lot through the character table, and I
do not have a lot of time for that at the moment; (2) is do not know how
to do.
"Peter" <xxxxxx@gmx.net> writes:
>> Saying that, however, I do use Emacs fontification to substitute fancy
>> symbols in place of lambda, define, set!, set-car, set-cdr, and some
>> other built-ins.
>
> Would you mind sharing that mapping? That sounds interesting!
--
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)