From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: "Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: add-hook and lambda functions
Date: Fri, 30 Mar 2007 22:33:10 +0200 [thread overview]
Message-ID: <87bqiampyx.fsf@ambire.localdomain> (raw)
In-Reply-To: <460D7012.6010608@gmail.com> (Lennart Borgman's message of "Fri\, 30 Mar 2007 22\:16\:18 +0200")
() "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
() Fri, 30 Mar 2007 22:16:18 +0200
In hs-minor-mode a lambda function is added to the hook:
(add-hook 'change-major-mode-hook
(lambda () (hs-minor-mode -1))
nil t)
Using a lambda function makes it a bit cumbersome to remove
this hook if you want to. I would therefor prefer if named
functions where used instead. Could this please be
changed?
it's a pretty common idiom. quick grep of "mode -1" shows
several dozen hits. for example, in image-mode.el:
(add-hook 'change-major-mode-hook
(lambda () (image-minor-mode -1))
nil t)
if you want to codify the idiom and convert applicable calls
(including hideshow) to use the new code, that would be a good
thing to do (after the release, probably).
perhaps i am ignorant; does such an abstraction already exist?
thi
next prev parent reply other threads:[~2007-03-30 20:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-30 20:16 add-hook and lambda functions Lennart Borgman (gmail)
2007-03-30 20:33 ` Thien-Thi Nguyen [this message]
2007-03-31 7:20 ` Richard Stallman
2007-03-31 18:33 ` Chong Yidong
2007-04-01 0:14 ` Lennart Borgman (gmail)
2007-04-01 7:45 ` David Kastrup
2007-04-01 18:35 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bqiampyx.fsf@ambire.localdomain \
--to=ttn@gnuvola.org \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.