I'm trying to enable whitespace mode but it doesn't seem to be working for me.
I've added the whitespace.el file to my .emacs.d/ directory. I added the following lines to me .emacs file:
(add-hook 'before-save-hook 'whitespace-cleanup)
(add-hook 'before-save-hook (lambda() (delete-trailing-whitespace)))
(require 'whitespace)
I did the following in the whitespace.el file:
M-x byte-compile-file <path to whitespace.el>
I tried executing the following command from any random text in emacs (e.g.: test.c):
M-x whitespace-toggle-options RET
But I just get a message saying [No match]
What am I missing?
Also, will I have to type in a command to enable the whitespace-mode every time I use emacs?
whitespace.el
has been included in Emacs for quite a while. Unless you have a very old version, you shouldn't need to manually put it anywhere, or do anything particularly special to use it.whitespace-toggle-options
probably isn't the function you want to use. Instead, trywhitespace-mode
:If you want to enable it by default, add
to your init file.