Endless Parentheses

Ramblings on productivity and technical subjects.

profile for Malabarba on Stack Exchange

New in Emacs 25.1: Have prettify-symbols-mode reveal the symbol at point

I’ve written before about what prettify-symbols-mode can do for your buffers, ranging from pure eye-candy to signficant readability improvements. Simply put, this minor-mode “disguises” some strings in your buffer to look like something else. For instance, in emacs-lisp-mode it makes lambda be displayed as λ, and (for the next release) it’ll apply to a wide range of symbols in (la)tex-mode too.

The only problem is that this (obviously) hides the symbol itself, and there’s no way of revealing it other than disabling the mode. That’s usually not a big deal, but it can get just a little annoying sometimes—specially when a mode adds over 400 elements to prettify-symbols-alist.

In Emacs 25.1, thanks to Tassilo Horn, there’s a new variable called prettify-symbols-unprettify-at-point. If you set it to t, prettify-symbols will “unprettify” a symbol as long as the cursor is inside it. So you can easily (and temporarily) reveal a symbol by just moving over to it.

My preference is to set it to right-edge which also reveals the symbol if the point is immediately after it.

(setq prettify-symbols-unprettify-at-point 'right-edge)
comments powered by Disqus