When you’re writing code you usually have to take into account the programming language’s convention for maximum line length. Most programming languages urge hackers to keep line length under 80 characters(although in recent years it has often been argued that such rules should be relaxed to 100-120 characters, given the state of current computer displays).
There are many ways to highlight lines that exceed a certain length in
Emacs, but I find one to be particularly elegant - the use of the
whitespace-mode. Most people use
visualize spaces, tabs and trailing whitespace, but it can actually do
a bit more that that. Here’s the magic config:
1 2 3 4 5
The above snippet will enable
whitespace-mode only in major modes
for programming. If you want to enable
you might want to do this instead:
whitespace-line-count determines that maximum line length; feel free
to set this to whatever value suits you.
what kind of stuff
whitespace-mode is going to highlight. At this
example we want to highlight only the part of lines exceeding the line
length limit. Take a look at
whitespace-style’s documentation for
C-h v RET whitespace-style).
Here’s the result:
It will probably come as no surprise that this functionality is enabled out-of-the-box in Prelude.