GNU bug report logs - #21311
25.0.50; non-defvared hooks are not declared special with lexical-binding

Previous Next

Package: emacs;

Reported by: Tassilo Horn <tsdh <at> gnu.org>

Date: Fri, 21 Aug 2015 12:00:04 UTC

Severity: minor

Found in version 25.0.50

Done: Tassilo Horn <tsdh <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 21311 <at> debbugs.gnu.org
Subject: bug#21311: 25.0.50; non-defvared hooks are not declared special with lexical-binding
Date: Fri, 21 Aug 2015 09:48:53 -0400
> It seems that hooks that are not declared using defvar but come into
> being just because of a (add-hook 'my-hook ...) are not declared as
> special meaning you cannot let-bind them to change their value in the
> dynamic scope of the let.

Yes.

> The bug disappears as soon as I
>   - don't use lexical-binding, or
>   - defvar the hook (Fix #1 or #2)

I think either of fix #1 or #2 are proper fixes and I think there's not
much more we can do about it.

If the hook hasn't been created yet at all (neither defvar, nor
add-hook) then fix #1 or #2 are really the only options.

Arguably, nowadays packages should defvar all their hooks.


        Stefan




This bug report was last modified 9 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.