Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently I started using Tmux, but I noticed that it causes a strange Emacs glitch. When I open source code for elisp or haskell, the comments aren't highlighted. Only the comment sign is (; in case of elisp, -- in case of haskell). The rest of the commented line is in normal colour. When I run Emacs outside of Tmux everything works as expected - the whole commented line is highlighted in a colour denoting a comment. Any ideas why this is happening?

SOLUTION: Based on Stefan's comment I added this to my .emacs file:

  '(font-lock-comment-face ((((class color)
                              (min-colors 8)
                              (background dark))
                              (:foreground "red"))))))

Now the comments are displayed in red, just like comment delimiters.

share|improve this question

migrated from Sep 18 '12 at 8:21

This question came from our site for professional and enthusiast programmers.

This is a software behavior question, not a programming question and is thus better suited for superuser, no wait, serverfault. no wait, i dont know, but somewhere else. – Wug Sep 16 '12 at 16:10
up vote 1 down vote accepted

This behavior is due to Emacs using a different coloring scheme when the number of colors is too limited. So the underlying cause of the difference is that in Tmux, the number of colors available is restricted (I don't know why). You can also change (with M-x customize-face RET) the faces font-lock-comment-face and font-lock-command-delimiter-face to simply work around the problem.

share|improve this answer
One possibility is to start tmux with the -2 option (256-color support) and to make sure you set TERM to screen-256color inside tmux. – chepner Sep 16 '12 at 20:53
Thanks chepner. Your solution works, but it also causes other colours to change. – killy9999 Sep 17 '12 at 7:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .