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

I have two versions of emacs available to me on a locked workstation:

$ /usr/local/bin/emacs --version
GNU Emacs 22.3.1

$ /usr/bin/emacs --version
GNU Emacs 21.4.1

In both cases, my terminal type is xterm when I run either version of emacs.

When I run the v21 version of emacs, I get syntax coloring for Perl, HTML, and other modes.

When I run the v22 version, I do not get syntax coloring.

I would like to migrate from the v21 version because the combination of v21 emacs, GNOME Terminal and GNU Screen is eating Ctrl-arrow key chords, which prevents me from moving quickly between words. (OS X Terminal and GNU Screen do not have this issue.) The v22 version allows use of Ctrl-arrow key combinations with GNOME Terminal and GNU Screen.

How do I fix the v22 version (or ask my sys admin to fix) so that it once again highlights syntax and allows me to use Ctrl-arrow key combinations?

share|improve this question
    
have you managed to resolve this? I'm having a similar problem. – bstpierre Aug 7 '10 at 2:29
up vote 5 down vote accepted

Add this line

(global-font-lock-mode 1)

to your .emacs file.

share|improve this answer
    
This had no effect, I'm afraid. – Alex Reynolds May 21 '10 at 23:31
    
Try to activate it manually, with M-x font-lock-mode, making sure you are in some programming language mode (like c-mode) first. – goedson May 22 '10 at 1:03

I was having the same problem, but only with c and c++ modes. Thanks to the hints above from @goedson I tracked it down.

Doing M-x font-lock-mode when in these modes showed me that it was already enabled. (The message I got back when running this was "Font-Lock mode disabled".)

Digging around through help (and my memory), I remembered that you have to apply the colors to the buffer ("fontify"). To test it manually, first make sure font-lock-mode is on and that you're in a programming language mode (e.g. perl, c). Then do font-lock-fontify-buffer. If you get colors, then you'll want to apply the change to your .emacs. Add something like this:

(add-hook 'c-mode-hook
          (function (lambda ()
                      (font-lock-fontify-buffer)
                      )))

You'll want to replace c-mode-hook with whatever mode is relevant for you, and you may want to repeat this for other modes. (I've done it for c and c++.)

share|improve this answer

I would try to change my TERM to something like xtermc, or xterm-256 or somehting like that.

Also, does M-x list-colors-display work for you ?

share|improve this answer

You must log in to answer this question.

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