help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reloading whitespace mode


From: Michael Heerdegen
Subject: Re: Reloading whitespace mode
Date: Thu, 03 Jul 2014 19:28:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (gnu/linux)

Gulshan Singh <address@hidden> writes:

> I've written a function to change a whitespace mode setting:
> https://gist.github.com/gsingh93/31192604a134c868f2a2
>
> In order to have that setting change take effect, I need to reload
> whitespace-mode.

You mean you want re-enable the mode, right (not reload the file)?

> I can do that manually by doing `M-x whitespace-mode` twice, but I
> want to do it from elisp. Calling whitespace-mode twice in elisp just
> breaks the mode.

In which way is it broken?

> How can I reload whitespace mode from elisp?

Note that from elisp, (whitespace-mode) without argument unconditionally
enables the mode (this is by convention, see documentation), so you
probably want

(progn (whitespace-mode -1)
       (whitespace-mode +1))

or, when you're sure the mode is turned on, also

(progn (whitespace-mode 'toggle)
       (whitespace-mode 'toggle))


HTH,

Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]