emacs-devel
[Top][All Lists]
Advanced

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

Re: add-hook and defvar


From: Philipp Stephani
Subject: Re: add-hook and defvar
Date: Tue, 24 Feb 2015 06:29:40 +0000



Stefan Monnier <address@hidden> schrieb am Mon Feb 23 2015 at 23:32:20:
>> Another problem is that defvar may simply never be called.
> But isn't it a bug to run-hooks a variable that was never explicitly
> defined?

All hook functions have always treated "unbound" as equal to nil, so no,
it's not considered a bug to run a hook that's still unbound.

Basically, given that "unbound == nil", what is a bug is to defvar
a hook with a non-nil default value, unless that hook is predefined
(i.e. is never unbound).


Is this something the byte compiler could warn about? At least normal hooks by convention end in "-hook", so a warning could be emitted every time such a variable is defined that doesn't have nil as default. 

reply via email to

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