Two related questions using emacs 23.3.1 on linux:
First, why can't I set the value of show-trailing-whitespace
to t
with setq
as shown below? When I put the setq
version in my .emacs
it does not change the value (as seen functionally and by using M-x describe-variable
).
(setq show-trailing-whitespace t) ; Does not change variable value or give error
(custom-set-variables ; Sets show-trailing-whitespace as expected
'(show-trailing-whitespace t))
Second, how can I toggle the value between t
and nil
? I thought that this answer was exactly what I needed, but it doesn't work in this case. I used:
(global-set-key "\M-ow" 'tf-toggle-show-trailing-whitespace)
(defun tf-toggle-show-trailing-whitespace ()
"Toggle show-trailing-whitespace between t and nil"
(interactive)
(setq show-trailing-whitespace (if (= show-trailing-whitespace nil) t nil))
(redraw-display))
When I hit M-ow
I get an error Wront type argument: number-or-marker-p, nil
. Any ideas?