unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Minor mode hook run when mode is deactivated?
Date: Thu, 08 Oct 2020 16:33:43 +0200	[thread overview]
Message-ID: <878scgait4.fsf@fastmail.fm> (raw)
In-Reply-To: <jwv362oq117.fsf-monnier+emacs@gnu.org>


On Thu, Oct 08 2020, Stefan Monnier wrote:
>> That makes sense, but it does mean that you cannot put a minor 
>> mode onto
>> another minor mode hook.[1]
>
> And expect this minor mode to be enabled/disabled along with the
> "parent" minor mode?  no, indeed!

No, not at all. :-) I added an extra hook variable that got run in 
the body of `define-minor-mode` when deactivating the "parent" 
mode, which I used to turn off the "child" minor mode. I was just 
surprised that the "child" mode was then immediately reactivated 
again.

>> Which is OK, I was just surprised that I wasn't able to find 
>> anything about
>> this in the documentation.  Is in there and I just didn't 
>> search well enough,
>> or should it perhaps be added?
>
> `C-h o <foo>-mode-hook RET` should say that it is run both when 
> leaving
> and entering.  So either your specific hook failed to mention 
> it, 

No, it's there. I just never bothered to look, because I it's a 
mode that I wrote myself. :-) I didn't realize that the mode hook 
gets a default doc string.

> or you
> looked in some other part of the doc.  In either case it sounds 
> like you
> found a documentation bug, so please report it (it's important 
> then to
> say exactly where you looked for that info).

I'll report it as a documentation bug, then. Thanks for your 
reply.


-- 
Joost Kremers
Life has its moments



      reply	other threads:[~2020-10-08 14:33 UTC|newest]

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

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=878scgait4.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).