I'm trying to get emacs whitespace-mode
enabled automatically only in certain modes. According to the documentation, enabling global-whitespace-mode
and setting the whitespace-global-modes
variable should do exactly that. But I can't get it to work correctly.
In my .emacs.el
I have:
(require 'whitespace)
(global-whitespace-mode t)
(setq whitespace-global-modes '(c-mode c++-mode))
but the definition of whitespace-global-modes
seems to be ignored; global-whitespace-mode
is enabled in every buffer. I know that I've got the variable name correctly, because C-h v whitespace-global-modes
tells me:
whitespace-global-modes's value is (c-mode c++mode)
Documentation:
Modes for which global `whitespace-mode' is automagically turned on.
...
So what am I doing wrong? Have I misunderstood the purpose of whitespace-global-modes
?
I'm running emacs 23.2.1.