* add-hook and lambda functions
@ 2007-03-30 20:16 Lennart Borgman (gmail)
2007-03-30 20:33 ` Thien-Thi Nguyen
2007-03-31 7:20 ` Richard Stallman
0 siblings, 2 replies; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-03-30 20:16 UTC (permalink / raw)
To: Emacs Devel
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?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: add-hook and lambda functions
2007-03-30 20:16 add-hook and lambda functions Lennart Borgman (gmail)
@ 2007-03-30 20:33 ` Thien-Thi Nguyen
2007-03-31 7:20 ` Richard Stallman
1 sibling, 0 replies; 7+ messages in thread
From: Thien-Thi Nguyen @ 2007-03-30 20:33 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Devel
() "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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: add-hook and lambda functions
2007-03-30 20:16 add-hook and lambda functions Lennart Borgman (gmail)
2007-03-30 20:33 ` Thien-Thi Nguyen
@ 2007-03-31 7:20 ` Richard Stallman
2007-03-31 18:33 ` Chong Yidong
1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-03-31 7:20 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: emacs-devel
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?
I agree.
There is no need to systematically change all such places,
at least not now; but if any of them actually gets in someone's way,
let's change it. Apparently this one did.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: add-hook and lambda functions
2007-03-31 7:20 ` Richard Stallman
@ 2007-03-31 18:33 ` Chong Yidong
2007-04-01 0:14 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2007-03-31 18:33 UTC (permalink / raw)
To: rms; +Cc: Lennart Borgman (gmail), emacs-devel
Richard Stallman <rms@gnu.org> writes:
> 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?
>
> I agree.
>
> There is no need to systematically change all such places,
> at least not now; but if any of them actually gets in someone's way,
> let's change it. Apparently this one did.
Done.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: add-hook and lambda functions
2007-03-31 18:33 ` Chong Yidong
@ 2007-04-01 0:14 ` Lennart Borgman (gmail)
2007-04-01 7:45 ` David Kastrup
0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-04-01 0:14 UTC (permalink / raw)
To: Chong Yidong; +Cc: rms, emacs-devel
Chong Yidong wrote:
> Richard Stallman <rms@gnu.org> writes:
>
>> 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?
>>
>> I agree.
>>
>> There is no need to systematically change all such places,
>> at least not now; but if any of them actually gets in someone's way,
>> let's change it. Apparently this one did.
>
> Done.
Thanks. It was very good to get this one done before the release.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: add-hook and lambda functions
2007-04-01 0:14 ` Lennart Borgman (gmail)
@ 2007-04-01 7:45 ` David Kastrup
2007-04-01 18:35 ` Stefan Monnier
0 siblings, 1 reply; 7+ messages in thread
From: David Kastrup @ 2007-04-01 7:45 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Chong Yidong, rms, emacs-devel
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> Chong Yidong wrote:
>> Richard Stallman <rms@gnu.org> writes:
>>
>>> 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?
>>>
>>> I agree.
>>>
>>> There is no need to systematically change all such places,
>>> at least not now; but if any of them actually gets in someone's way,
>>> let's change it. Apparently this one did.
>>
>> Done.
>
> Thanks. It was very good to get this one done before the release.
I find it surprising to have turn-off-hideshow without a corresponding
turn-on-hideshow. Is the latter not expected to be used? I don't
know hideshow enough to give an educated guess.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: add-hook and lambda functions
2007-04-01 7:45 ` David Kastrup
@ 2007-04-01 18:35 ` Stefan Monnier
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2007-04-01 18:35 UTC (permalink / raw)
To: David Kastrup; +Cc: Chong Yidong, Lennart Borgman (gmail), rms, emacs-devel
> I find it surprising to have turn-off-hideshow without a corresponding
> turn-on-hideshow. Is the latter not expected to be used? I don't
> know hideshow enough to give an educated guess.
These are internal functions, not commands, so regularity is not
particularly important.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-04-01 18:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-30 20:16 add-hook and lambda functions Lennart Borgman (gmail)
2007-03-30 20:33 ` Thien-Thi Nguyen
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
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.