Support highlighting fill-column overflows

This was previously semi-supported. There were two problems, however:

1. My fill-column value of 80 got out-of-sync with my white-line-column
   value of 100.
   Solution: globally define wpc/fill-column, set that to 80, and
   consume the new const in my config.

2. Nothing was activating whitespace mode.
   Solution: add whitespace-mode to prog-mode-hook.

This SO answer helped tremendously:
https://stackoverflow.com/questions/18855510/have-emacs-highlight-characters-over-80
This commit is contained in:
William Carroll 2018-08-09 12:02:18 -04:00
parent 2211d65557
commit 6393e47c77
3 changed files with 10 additions and 3 deletions

View file

@ -70,7 +70,7 @@
create-lockfiles nil) create-lockfiles nil)
;; ensure code wraps at 80 characters by default ;; ensure code wraps at 80 characters by default
(setq-default fill-column 80) (setq-default fill-column wpc/fill-column)
(put 'narrow-to-region 'disabled nil) (put 'narrow-to-region 'disabled nil)

View file

@ -127,8 +127,11 @@
;; highlight lines that are over 100 characters long ;; highlight lines that are over 100 characters long
(use-package whitespace (use-package whitespace
:config :config
(setq whitespace-line-column 100) (setq whitespace-line-column wpc/fill-column)
(setq whitespace-style '(face lines-tail))) (setq whitespace-style '(face lines-tail))
(add-hook 'prog-mode-hook #'whitespace-mode))
;; disable GUI scrollbars ;; disable GUI scrollbars
(when (display-graphic-p) (when (display-graphic-p)

View file

@ -18,5 +18,9 @@
[mouse-5] [down-mouse-5] [drag-mouse-5] [double-mouse-5] [triple-mouse-5]) [mouse-5] [down-mouse-5] [drag-mouse-5] [double-mouse-5] [triple-mouse-5])
"This variable stores all of the mouse-related keybindings that Emacs recognizes.") "This variable stores all of the mouse-related keybindings that Emacs recognizes.")
(defconst wpc/fill-column
80
"Variable used to set the defaults for wrapping, highlighting, etc.")
(provide 'variables) (provide 'variables)
;;; variables.el ends here ;;; variables.el ends here