GNU bug report logs - #48584
28.0.50; Incorrect hook ordering between local and global hooks with depth

Previous Next

Package: emacs;

Reported by: Philipp <p.stephani2 <at> gmail.com>

Date: Sat, 22 May 2021 11:22:02 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Philipp <p.stephani2 <at> gmail.com>
Cc: 48584 <at> debbugs.gnu.org
Subject: bug#48584: 28.0.50; Incorrect hook ordering between local and global hooks with depth
Date: Sun, 06 Jun 2021 11:12:24 +0200
Philipp <p.stephani2 <at> gmail.com> writes:

>> If I'm reading run_hook_with_args correctly, it'll loop over the local
>> hook first (in order), and when it happens upon a t in that value, it'll
>> then loop over the global value (in order), and then finish up the rest
>> of the local ones.
>
> Yes - and that's a reasonable behavior to expect, and we should document it.

I think it's an implementation detail that users should not depend on.
Where that `t' ends up being depends on many subtle things like the
order of your add-hook/remove-hook calls in your .emacs file.

> Correct hook ordering is crucial for abnormal hooks.  We already rely
> on the very specific ordering behavior several times in the Emacs
> codebase alone.  I've searched a bit through the Emacs codebase, and
> found the following places where Emacs runs an abnormal hook with
> `run-hook-with-args-until-success/failure' that also gains a local
> part somewhere the codebase:

[...]

> That is, we rely on this "undefined" behavior already in very basic
> operations such as saving buffers to file.  In Eldoc, we even
> explicitly tell users to add functions to the local part of this
> abnormal hook (eldoc-documentation-functions), thereby telling them to
> rely on "undefined" behavior!  This hopefully shows that the behavior
> is far from being undefined.

I don't think it shows any such thing.

I think it'd be a good idea to implement (and document) something in
this area that actually allows users to control the hook running order
properly, which currently just isn't possible.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 345 days ago.

Previous Next


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