Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use emacs prettify-symbols-mode?

Tags:

emacs

I have emacs version 25.0, I enable prettify-symbols-mode, and type (lambda () t) but it doesn't prettify. How do I use this mode? Also what symbols are available and how can I configure it? Any references are appreciated.

Edit: Nothing happened in scratch buffer and Markdown mode, but when I tried in a Emacs-lisp mode, It did prettify, but now I got a question mark instead of the lambda symbol, how do I fix that?

Edit: I asked the related question here.

Edit: This SO question solved the unicode problem.

like image 253
user3995789 Avatar asked Oct 30 '14 15:10

user3995789


1 Answers

prettify-symbols-mode is buffer-local. If you want to enable it globally, use global-prettify-symbols-mode.

The question mark you are seeing is probably because Emacs can't find a font that contains a lambda character. Try switching to a font with decent Unicode support like DejaVu Sans Mono.

I believe that only Lambda prettifies out of the box, and only in emacs-lisp-mode buffers. Check the value of prettify-symbols-alist from a buffer with prettify-symbols enabled to see the current replacements table.

If you wish to add prettification of other symbols you can do something like this, from C-h f prettify-symbols-mode RET:

(add-hook 'emacs-lisp-mode-hook
          (lambda ()
            (push '("<=" . ?≤) prettify-symbols-alist)))
like image 190
Chris Avatar answered Sep 19 '22 13:09

Chris