emacswhitespace

Highlighting trailing whitespace in emacs without changing character


I am trying to get emacs to highlight trailing-spaces. I have tried using WhiteSpace, and also tried setting show-trailing-whitespace variable to true, but in each case it changes the representation of newline and space characters to $ and · characters, as shown in this screen capture.

Ideally I would like to just see the trailing whitespace highlighted in red without any such characters.

Disclaimer: I'm new to emacs, so this may well be obvious.


Solution

  • Change the value of the whitespace-style variable to

    (face trailing)
    

    You might need to restart whitespace-mode for the changes to take effect.

    To set a variable, use M-xset-variableEnter.