unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: help-gnu-emacs@gnu.org
Cc: davidshepherd7@gmail.com
Subject: Converting a list of `set' calls to a minor mode
Date: Sat, 13 Aug 2016 09:03:33 -0700	[thread overview]
Message-ID: <20160813160333.gahqlrcq42hkl2yy@hephaestus.silentflame.com> (raw)

[-- 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 --]

             reply	other threads:[~2016-08-13 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-13 16:03 Sean Whitton [this message]
2016-08-15 16:41 ` Converting a list of `set' calls to a minor mode David Shepherd
2016-08-15 23:20   ` Stefan Monnier
2016-09-01 19:14   ` David Shepherd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160813160333.gahqlrcq42hkl2yy@hephaestus.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=davidshepherd7@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).