Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

(custom-set-variables
 (custom-set-faces
  '(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
    
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
add comment

migrated from stackoverflow.com Sep 18 '12 at 8:21

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

1 Answer

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
1  
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.