This is probably the worst patch you've ever seen - not sure whether the
"advice" I added is the optimal one to add, it just seems to solve the
problem for me. Adding unused "&rest args" to a function so that it can
be used as advice is probably incorrect as well.
Problem was, with global-whitespace-mode enabled, when I switched to a
new buffer (say C-x b asdf <RET>), whitespace was not visible. The
`whitespacesturn-on-if-enabled' function is already added to
after-change-major-mode-hook, but apparently that isn't triggered when a
new buffer is created in fundamental-mode. If I turn
global-whitespace-mode off and back on again, or if I type "M-x
fundamental-mode", then whitespace is visible.
The fix I came up with in my init file was to add the code:
(defun whitespace-turn-on-if-enabled-2 (&rest args)
(whitespace-turn-on-if-enabled))
(advice-add 'switch-to-buffer :after 'whitespace-turn-on-if-enabled-2)
But I figured I would create a patch and let you guys look at it and
decide what should be done. I have attached it. It works for me, but
might not fix a wider root cause, and is almost certainly not the
optimal elisp code in any case.
Jefferson Carpenter
P.S. Even with the above fix (either init file or whitespace.el patch),
when I switch to a new buffer, whitespace is shown but in the wrong
color. It remains the wrong color if I turn global-whitespace-mode off
and on again, but uses the "whitespace-space" face, etc. as it should,
when I run "M-x fundamental-mode" (the buffer already being in
fundamental-mode).