Have written this function to change the style for global-whitespace-mode
. I describe the problem as follows. Suppose one calls (space-glow "tab-trail")
followed by (space-glow "allvis")
. But trying to do (space-glow "tab-trail")
again, the style does not take effect.
(defun space-glow (form)
"Global visualisation of tabs and trailing spaces."
(interactive
(list
(let* ( (cseq '("allvis" "tab-trail" "disable")) )
(completing-read " Space_glow: " cseq nil t "tab-trail"))))
(require 'whitespace)
(pcase form
("tab-trail"
(setq whitespace-style '(face tab-mark tabs trailing))
(global-whitespace-mode 1))
("allvis"
(setq whitespace-style '(face tabs spaces trailing lines
space-before-tab newline indentation empty
space-after-tab space-mark tab-mark newline-mark))
(global-whitespace-mode 1))
("disable"
(global-whitespace-mode 0))) )
(global-whitespace-mode 0)
when a mode might not be available?whitespace-mode
is a mode that is automatically available in emacs, correct? – Dilna Jul 20 '22 at 01:36require
. – Drew Jul 20 '22 at 02:32require
imports (loads) the appropriate functionalities, then the value forwhitespace-style
can be set and used by the feature that uses it. Is it customary to require disabling a mode to reset a customisation variable? Are there packages that react dynamically to changes, and would it be the preferred behaviour? – Dilna Jul 20 '22 at 02:57