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 ov
There is a built-in package in emacs-goodies-el
(recommend to install it in terminal) called highlight-beyond-fill-column.el, add this to your .emacs
or init.el
:
(setq-default fill-column 80)
(add-hook 'prog-mode-hook 'highlight-beyond-fill-column)
(custom-set-faces '(highlight-beyond-fill-column-face
((t (:foreground "red" )))))
The text beyond fill-column
which is 80 in the snippet will be highlighted with the color of red
. You can set the face as you like.
This is not exactly what you wanted, but I had a similar problem and found this question/answer. All I wanted was to insert a visual guide, when I needed it. This is what I finally ended up with:
(defun insert-80 ()
"Insert an 80-character-wide guide at beginning of line."
(interactive)
(beginning-of-line)
(insert "0 1 2 3 4 5 6 7 |")
(newline)
(insert "01234567890123456789012345678901234567890123456789012345678901234567890123456789|")
(newline)
)
Super simple, but sometimes very effective.