* Reloading whitespace mode
@ 2014-07-02 19:49 Gulshan Singh
2014-07-03 17:28 ` Michael Heerdegen
0 siblings, 1 reply; 2+ messages in thread
From: Gulshan Singh @ 2014-07-02 19:49 UTC (permalink / raw)
To: help-gnu-emacs
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. 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.
How can I reload whitespace mode from elisp?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Reloading whitespace mode
2014-07-02 19:49 Reloading whitespace mode Gulshan Singh
@ 2014-07-03 17:28 ` Michael Heerdegen
0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2014-07-03 17:28 UTC (permalink / raw)
To: help-gnu-emacs
Gulshan Singh <gsingh_2011@yahoo.com> 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-03 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-02 19:49 Reloading whitespace mode Gulshan Singh
2014-07-03 17:28 ` Michael Heerdegen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.