GNU bug report logs -
#48584
28.0.50; Incorrect hook ordering between local and global hooks with depth
Previous Next
Full log
Message #8 received at 48584 <at> debbugs.gnu.org (full text, mbox):
Philipp <p.stephani2 <at> gmail.com> writes:
> Evaluate these forms:
>
> (add-hook 'my-hook (lambda () (message "Outer")) 20)
> (with-temp-buffer
> (add-hook 'my-hook (lambda () (message "Inner")) 10 :local)
> (run-hooks 'my-hook))
>
> Then in the *Messages* buffer, "Inner" appears *after* "Outer" even
> though the local function's depth is lower than the global one's.
Looking at the code, the order is computed by `add-hook' by stashing
data in the symbol plist of my-hook, but the hook function is then
pushed onto either the local or the global version of the variable. So
the ordering isn't global -- it's one ordering for the local and one for
the global, and `run-hooks' doesn't say anything about what order the
local and global values are run in?
(The global value is run when `t' appears in the local value.)
So... I don't see any obvious way to fix this, and perhaps we should
just document that the order is undefined when you have both local and
global hooks with the same name.
Any opinions?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 15 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.