From: Platon Pronko <platon7pronko@gmail.com>
To: uzibalqa <uzibalqa@proton.me>
Cc: uzibalqa via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: add-hook without need for intermediate functions
Date: Sun, 11 Jun 2023 09:37:04 +0800 [thread overview]
Message-ID: <381c727e-5746-74f6-8c49-c55d243728f0@gmail.com> (raw)
In-Reply-To: <JFSDfxM2RknpxuCFj3vPwHuCl07ZEQZh6HAdAqlM-c3QuHwn8amST4riY4qcLaHVJq0rZ8Ilpi75rksFvgmq00bK77FLcQHmQn1yHwC6uHI=@proton.me>
>> However note that this won't work for your use-case (from previous thread) - hook is called both when mode is turned on, and when it is turned off. So in your code snippet foo-minor-mode will be turned on when emacs-lisp-mode is turned off, which is probably not something you would want. - Platon Pronko
>
> What would one do then, remove the hook at some point. Would you show me an example on how to handle the situation
> properly.
>
Here's an example I've sent in one of previous emails:
(defun tematika--toggle-outline-mode ()
(if tematika-minor-mode
(outline-minor-mode)
(outline-minor-mode -1)))
(add-hook 'tematika-minor-mode-hook 'tematika--toggle-outline-mode)
prev parent reply other threads:[~2023-06-11 1:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 15:48 add-hook without need for intermediate functions uzibalqa
2023-06-09 16:56 ` [External] : " Drew Adams
2023-06-09 17:05 ` uzibalqa
2023-06-09 17:15 ` Drew Adams
2023-06-09 17:30 ` uzibalqa
2023-06-09 20:07 ` Emanuel Berg
2023-06-10 21:05 ` Drew Adams
2023-06-10 8:20 ` Platon Pronko
2023-06-10 15:21 ` uzibalqa
2023-06-11 1:37 ` Platon Pronko [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=381c727e-5746-74f6-8c49-c55d243728f0@gmail.com \
--to=platon7pronko@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=uzibalqa@proton.me \
/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).