On Wed, Mar 4, 2009 at 6:18 AM, Stefan Monnier
<address@hidden> wrote:
> Say a file contains an add-hook form with a lambda argument:
> (add-hook 'foo-mode (lambda () (bar)))
> Annoyingly, the function will be added to the hook twice if the file
> is byte compiled, loaded, then reevaluated (such as with eval-buffer).
As a general rule, you should not put a lambda but a function name
(i.e. a symbol) instead, to avoid all those problems (and be able to
replace the function with a newer version of it). But occasionally
a lambda is really exactly what you want, of course.
My reason is that from a user point of view, lambda serves the same purpose as function name, and one less thing to worry about problems that might come from byte compiling.