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

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

Converting a list of `set' calls to a minor mode


From: Sean Whitton
Subject: Converting a list of `set' calls to a minor mode
Date: Sat, 13 Aug 2016 09:03:33 -0700

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: signature.asc
Description: PGP signature


reply via email to

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