How to highlight parts of the code that are longer than 80 characters?
In Emacs, I would like to highlight parts of long lines that are longer than 80 characters.
The package is highlight-80+
great for this. But how can I automatically enable it when loading the C ++ source file?
I tried adding highlight-80+
to C ++ mode, but that didn't work:
(require 'highlight-80+) (defun my-c++-mode-common-hook () (highlight-80+-mode 1)) (add-hook 'c++-mode-common-hook 'my-c++-mode-common-hook)
When I download the .cc file, it goes into C ++ mode, but highlight-80+
not enabled, so long lines are unchecked.
source to share
Note that the Highlight80Plus wiki says it is embedded in emacs starting at 23. I believe this refers to spatial mode; it does this and is built into emacs.
There is a function emacs-starter-kit that already does something like this, but you can easily duplicate it,
(defun esk-turn-on-whitespace () (whitespace-mode t)) (add-hook 'prog-mode-hook 'esk-turn-on-whitespace)
source to share