emacs-devel
[Top][All Lists]
Advanced

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

Re: add-hook and lambda functions


From: Thien-Thi Nguyen
Subject: Re: add-hook and lambda functions
Date: Fri, 30 Mar 2007 22:33:10 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux)

() "Lennart Borgman (gmail)" <address@hidden>
() 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




reply via email to

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