12

I want globally enable whitespace-mode. I have tried this in my .emacs:

(require 'whitespace)
(setq-default whitespace-style '(face trailing lines empty indentation::space))
(setq-default whitespace-line-column 80)
(setq global-whitespace-mode 1)
(whitespace-mode 1)

but without success... I able to enable it via M+x whitespace-mode, but I want it to enable it globally... Any suggestions? I am using GNU Emacs 23.3.1 .

Vladimir Mihailenco
  • 3,382
  • 2
  • 24
  • 38
  • 1
    Note that `whitespace-mode` and `global-whitespace-mode` are different minor modes. The former is buffer-local, the latter is not. If the buffer-local mode is enabled for a given buffer, the global mode will not have any effect on that buffer. – phils Jun 17 '11 at 08:16

1 Answers1

26

In general it's best to enable/disable modes by using the function call, not setting the variable (which is what you did for global-whitespace-mode).

Try:

(global-whitespace-mode 1)
Trey Jackson
  • 73,529
  • 11
  • 197
  • 229