I know there are solutions to making emacs show the 80 line column, but I don't want that sort of visual disturbance. I'd just like to make it highlight a line if it's over 80 characters.
Another easy option is to run highlight-lines-matching-regexp
on the expression .\{81\}
.
Every line with 81 characters or more will be highlighted with the color of your choice.
See whitespace-mode
-- it's now part of Emacs, and can do much more than highlighting just long lines. (But of course can be used to do only that.)
Here's my config from Emacs Dev Kit:
;; whitespace-mode
;; free of trailing whitespace and to use 80-column width, standard indentation
(setq whitespace-style '(trailing lines space-before-tab
indentation space-after-tab)
whitespace-line-column 80)
Basically you need just the last bit, but I find the other settings quite useful (I hate tabs and trailing whitespaces).
Try highlight-80+.el
. You can acquire it from here.
To install it, just add the following to your .emacs
:
(add-to-list 'load-path "/path/to/highlight-80+")
(require 'highlight-80+)
You can then enable it via:
M-x highlight-80+-mode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With