all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Converting a list of `set' calls to a minor mode
@ 2016-08-13 16:03 Sean Whitton
  2016-08-15 16:41 ` David Shepherd
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Whitton @ 2016-08-13 16:03 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: davidshepherd7

[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]

Hello,

[Kindly keep me in the CC as I'm not subscribed]

I want to convert frames-only-mode[1] to an actual global minor mode.
At present, it is just a long list of calls to `set' and `advice-add'.

When deactivating the minor mode, undoing the `advice-add' calls is
straightforward, but I also need to undo the `set' calls.  I think that
they should be set back to whatever they were set to previously, so long
as the user hasn't modified them since the minor mode was activated.
I.e., for each var, if

- var was set to foo before the minor mode was activated, and
- we set var to bar when activating the minor mode, and
- var is still set to bar

... then we set var back to foo.

Is there some macro to do this?  I envisage calling (set-and-remember
var) when activating the minor mode and (restore var) when deactivating
it.  Surely there is already a global minor mode that has solved this
problem.

Thanks!

[1] https://github.com/davidshepherd7/frames-only-mode/

-- 
Sean Whitton

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-01 19:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-13 16:03 Converting a list of `set' calls to a minor mode Sean Whitton
2016-08-15 16:41 ` David Shepherd
2016-08-15 23:20   ` Stefan Monnier
2016-09-01 19:14   ` David Shepherd

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.