[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: add-hook sets hook globally if buffer-local hook is nil
From: |
Lute Kamstra |
Subject: |
Re: add-hook sets hook globally if buffer-local hook is nil |
Date: |
Wed, 22 Oct 2003 16:31:05 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>>> This new behavior is intended; it is documented in the docstring of
>>> add-hook and in the section on hooks in the Lisp Reference manual.
>
> Where is it documented exactly ? Could you quote the text you're
> referring to ?
E.g., from add-hook's docstring:
The optional fourth argument, LOCAL, if non-nil, says to modify
the hook's buffer-local value rather than its default value.
I understand this as: if LOCAL is nil, modify the default value. I
understand default value as in (default-value HOOK).
>> Gack, that's even worse.
>
> Indeed, I think it's a bug. It's introduced by the change below
> which I think should be reverted. What was the reason for the change ?
>
> @@ -856,9 +870,7 @@
> (set (make-local-variable hook) (list t)))
> ;; Detect the case where make-local-variable was used on a hook
> ;; and do what we used to do.
Whoops, I forgot that the code checks for this situation. This check,
although probably sane with respect to backward compatibility, is not
in agreement with the docstring.
> - (when (and (local-variable-p hook)
> - (not (and (consp (symbol-value hook))
> - (memq t (symbol-value hook)))))
> + (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook)))
> (setq local t)))
> (let ((hook-value (if local (symbol-value hook) (default-value hook))))
> ;; If the hook value is a single function, turn it into a list.
I guess Richard overlooked the (make-variable-buffer-local HOOK)
possibility that does not immediately create a buffer-local variable.
Lute.
- add-hook sets hook globally if buffer-local hook is nil, Alan Shutko, 2003/10/21
- Re: add-hook sets hook globally if buffer-local hook is nil, Klaus Zeitler, 2003/10/22
- Re: add-hook sets hook globally if buffer-local hook is nil, Lute Kamstra, 2003/10/22
- Re: add-hook sets hook globally if buffer-local hook is nil, Klaus Zeitler, 2003/10/22
- Re: add-hook sets hook globally if buffer-local hook is nil, Alan Shutko, 2003/10/22
- Re: add-hook sets hook globally if buffer-local hook is nil, Stefan Monnier, 2003/10/22
- Re: add-hook sets hook globally if buffer-local hook is nil,
Lute Kamstra <=
- Re: add-hook sets hook globally if buffer-local hook is nil, Richard Stallman, 2003/10/23
- Re: add-hook sets hook globally if buffer-local hook is nil, Stefan Monnier, 2003/10/23
- Re: add-hook sets hook globally if buffer-local hook is nil, Richard Stallman, 2003/10/24
- Re: add-hook sets hook globally if buffer-local hook is nil, Stefan Monnier, 2003/10/26