The new prettify-symbols-mode in Emacs works beautifully for translating:
lambda something -> λ something
I'd also like to make:
lambda.something -> λsomething
Sadly, prettify-symbols-mode only recognizes spaces as word/symbol separators by default.
Any ideas on how to use '.' as a token separator?
The code that does the actual substitution is prettify-symbols--compose-symbol
in prog-mode.el
. It excludes matches if the character before or after the word has the character type word or symbol. In many mode, for example emacs-lisp-mode
the .
character has symbol type.
You could either change the syntax code for .
in the major mode, you could tell font-lock
to use a different character code when highlighting (see the variable font-lock-defaults
for details), or you could do ju-jutsu on the prettify-symbols--compose-symbol
mode like modifying it using defadvice
or simply replace it with your own.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With