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

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

Re: Minor mode hook run when mode is deactivated?


From: Joost Kremers
Subject: Re: Minor mode hook run when mode is deactivated?
Date: Thu, 08 Oct 2020 16:33:43 +0200
User-agent: mu4e 1.5.5; emacs 27.1.50


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 via email to

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