0

I am trying to disable prettify-symbols-mode when I use emacs in the terminal. The reason is that unicode support in the terminal is not as good as in the GUI mode. So it causes a problem with editing my R scripts.

Here is what I came up with to put in my emacs config:

(add-hook 'after-make-frame-functions
          (lambda ()
                  (when (not (display-graphic-p))
                    (prettify-symbols-mode -1)
                    )
                  )
          )

This seems to work when I start emacs with emacs -nw. But it emacsclient quits immediately after it finishes starting up emacs daemon.

biocyberman
  • 5,675
  • 8
  • 38
  • 50
  • You have a bug in your code -- your function must accept a FRAME argument. That will prevent the error, but your code still won't really work. `prettify-symbols-mode` doesn't use a frame-parameter; it's a buffer-local minor mode. So you're setting it for a single buffer -- a buffer which might appear in both terminal and GUI frames simultaneously. You could set the mode for all buffers, but that just means you have the same issue for all buffers. – phils Aug 04 '18 at 11:53
  • 1
    Btw, unless you're killing and restarting Emacs, don't fix your code until you've removed the original version from the hook variable. That's one of the reasons why it's a bad idea to add lambda forms to hooks. Use a named function instead. – phils Aug 04 '18 at 11:55
  • Note that faces can vary on a terminal-type basis. Perhaps you can define your prettified symbols such that they use faces which only take effect in GUI frames? (Just speculation.) – phils Aug 04 '18 at 11:59

0 Answers0