🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87500

[19.27]: add-hook mucks up buffer-local-ness of post-command-hook

#87500
From: Simon Marshall
Date: Mon, 19 Sep 1994 11:57
44 lines
2224 bytes
In GNU Emacs 19.27.1 (sparc-sun-sunos4.1.3C, X toolkit) of Thu Sep 15 1994 on penelope

If you use APPEND of add-hook, the buffer-local-ness of the hook is
removed:

% emacs -q

Insert into *scratch* and eval each of the following forms:

(defun foo ()
  (message "foo!")
  (sit-for 2)
  (message ""))

(defun bar ()
  (message "bar!")
  (sit-for 2)
  (message ""))

(add-hook 'post-command-hook 'foo)
(make-local-variable 'post-command-hook)
(add-hook 'post-command-hook 'bar)

Moving about the buffer runs `bar' and `foo' in turn as you would expect.
Now ESC ESC SPC to get into the minibuffer.  You can see that only `foo'
is run (type C-h v post-command-hook RET to make sure the value is (foo)).
This is correct.

Now start another emacs, and insert the previous forms as before, except
the last form which should be:

(add-hook 'post-command-hook 'bar t)

so that `bar' is appended to the hook.

Now moving about the buffer runs `foo' and `bar' in turn as you would expect.
Now ESC ESC SPC to get into the minibuffer.  You can see that both `foo'
and `bar' are run.  The value of post-command-hook is (foo bar).

This is wrong, I think.  Si.
_______________________________________________________________________________
Simon Marshall, ESRIN (ESA), Via Galileo Galilei, Frascati 00044 (Roma), Italia
"Diego Maradona---a flawed genius whose genius has become flawed."  Bob Wilson.
 Email: Simon.Marshall@mail.esrin.esa.it  Voice: +39 6 941 80 707  Fax: 80 361
Technical Details
Message-ID: <9409191148.AA11977@plod.esrin.esa.it>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!mail.ESrin.ESa.IT!Simon.Marshall

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,633fdd8ade2f4175,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-09-19 22:14:53 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!mail.ESrin.ESa.IT!Simon.Marshall
From: Simon.Marshall@mail.ESrin.ESa.IT (Simon Marshall)
Newsgroups: gnu.emacs.bug
Subject: [19.27]: add-hook mucks up buffer-local-ness of post-command-hook
Date: 19 Sep 1994 07:57:31 -0400
Organization: GNUs Not Usenet
Lines: 44
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9409191148.AA11977@plod.esrin.esa.it>