[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Idempotency of add-hook wrt lambda expressions
From: |
Stefan Monnier |
Subject: |
Re: Idempotency of add-hook wrt lambda expressions |
Date: |
Wed, 04 Mar 2009 09:18:12 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) |
> 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.
Stefan
- Idempotency of add-hook wrt lambda expressions, Geoff Gole, 2009/03/04
- Re: Idempotency of add-hook wrt lambda expressions,
Stefan Monnier <=
- Re: Idempotency of add-hook wrt lambda expressions, David Reitter, 2009/03/04
- Re: Idempotency of add-hook wrt lambda expressions, Stephen J. Turnbull, 2009/03/04
- Re: Idempotency of add-hook wrt lambda expressions, Stefan Monnier, 2009/03/04
- Re: Idempotency of add-hook wrt lambda expressions, Geoff Gole, 2009/03/05
- Re: Idempotency of add-hook wrt lambda expressions, David Kastrup, 2009/03/05
- Re: Idempotency of add-hook wrt lambda expressions, tomas, 2009/03/05