unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: help-gnu-emacs@gnu.org
Subject: Minor mode hook run when mode is deactivated?
Date: Thu, 08 Oct 2020 01:15:06 +0200	[thread overview]
Message-ID: <87d01tr5l1.fsf@fastmail.fm> (raw)

Hi,

I recently ran into a problem that was apparently caused by a 
minor mode hook being run when the mode is deactivated. 
Counter-intuitive as that may be (to me, at least), a quick look 
at the code for `define-minor-mode` seems to suggest that it's in 
fact correct.

Is there a rationale behind this? I noticed in the code that there 
are actually two more hooks, `<mode>-on-hook` and 
`<mode>-off-hook`, which according to a comment in the code are 
there for backward compatibility only. Which suggests that someone 
at some point thought about these things and made a conscious 
decision to this effect.

Which in turn makes me wonder what the rationale was for that 
decision. :-) Also, I haven't been able to find any info on this 
in the Elisp and Emacs manuals. Aren't minor modes supposed to be 
turned off?

TIA


-- 
Joost Kremers
Life has its moments



             reply	other threads:[~2020-10-07 23:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 23:15 Joost Kremers [this message]
2020-10-07 23:45 ` Minor mode hook run when mode is deactivated? Stefan Monnier
2020-10-08  6:44   ` Joost Kremers
2020-10-08 13:53     ` Stefan Monnier
2020-10-08 14:33       ` Joost Kremers

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=87d01tr5l1.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --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).