7

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.

Community
  • 1
  • 1
user3995789
  • 3,452
  • 1
  • 19
  • 35

1 Answers1

6

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)))
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • I tried `global-prettify-symbols-mode` but it didn't work, how do I configure these symbols and what symbols are available, eg, does `->` prettify? \ About the font, my terminal already uses Dejavu Sans, and I can see the lambda on the shell, do I have to set the font for emacs, and how do I do th\ at? I use mintty for my terminal. – user3995789 Oct 30 '14 at 16:08
  • How do I insert a lambda symbol myself, and test this unicode support on emacs, for example I type `C-x 8 CCBB` and it displays `\uCCBB`, I expect it to display the greek lambda symbol. – user3995789 Oct 30 '14 at 16:11
  • @user3995789, see my updated answer. To manually insert a Unicode lambda, try `C-x 8 RET GREEK SMALL LETTER LAMBDA RET`. You should be able to complete the name of the character with tab (or Helm or ido, if you're using one of those). You could also copy and paste from a document that contains the proper Unicode character. – ChrisGPT was on strike Oct 30 '14 at 16:15
  • Thanks, for the answer, I get `\u03BB` when I insert the lambda, how do I configure emacs to support unicode symbols? I need the greek symbol. – user3995789 Oct 30 '14 at 16:18
  • @user3995789, an Emacs trunk build (you said version 25.0, but this doesn't exist yet) should fully support Unicode. This is almost certainly an issue with your font. Have you tried switching to DejaVu Sans Mono, even just temporarily to test Unicode display? – ChrisGPT was on strike Oct 30 '14 at 16:19
  • Omg, how do I switch fonts, I said my terminal already is Dejavu Sans, are you talking about switching font for emacs, I have no idea how to do that. Also how do I test unicode display? Please provide a full explanation, I am a complete newbie. – user3995789 Oct 30 '14 at 16:22
  • Oh, you're running inside a terminal. In that case setting the terminal font should be the right way to do it. In that case, [make sure your terminal is configured for UTF-8](http://stackoverflow.com/questions/12649896/why-doesnt-my-terminal-output-unicode-characters-properly). – ChrisGPT was on strike Oct 30 '14 at 16:26
  • When I do `echo -e "\xce\xbb"` I successfully get the greek letter symbol, so my terminal supports utf-8, also it uses dejavu sans, but emacs is failing. – user3995789 Oct 30 '14 at 16:29
  • 1
    Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63946/discussion-between-chris-and-user3995789). – ChrisGPT was on strike Oct 30 '14 at 16:31