Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off Emacs Whitespace-mode "Long Line" Visualization

I personally keep all lines under 80 characters, but I also work on projects in teams where other programmers don't care about line length.

I love using whitespace-mode, but the long line visualization is really annoying when I'm working on projects where I shouldn't interfere with the long lines. It seems like it should be easy to turn off the long line visualization---I hit m-x global-whitespace-toggle-options l, and then can hit m-x global-whitespace-toggel-options ? to confirm that the "long-line visualization" is turned off. But long lines are still highlighted. I kill buffers and reload them, and highlighting is still there. I'm definitely using global, not local, whitespace-mode.

Why can't I turn off the long line visualization?

like image 932
rubergly Avatar asked Jul 29 '11 23:07

rubergly


2 Answers

The last time I customized whitespace-mode, I noticed that my changes to the settings didn't have any effect in buffers that already existed; try recreating the buffer, or leaving and reentering whitespace-mode. In case you don't already know, you can use M-x customize-group whitespace to turn off that particular option entirely, rather than doing it manually.

Edit: Specifically you want to customize the whitespace-style variable. This lets you turn on and off individual styles. In this case you should turn off the ones labelled "(Face) Lines" and "(Face) Lines, only overlong part". The former changes the face of the whole line when it is overly long, while the latter only changes the face of the part that extends past the threshold.

(Other options in this group define the faces that whitespace-mode will use to highlight the styles you've turned on, the regexes it uses to identify certain situations, etc, but usually you only care about whitespace-style).

like image 54
db48x Avatar answered Sep 20 '22 03:09

db48x


Set whitespace-line-column to a higher value (default is 80), so the highlighting of long lines doesn't kick in:

(setq whitespace-line-column 250)

like image 30
Achim S. Avatar answered Sep 20 '22 03:09

Achim S.