Subject: bug#65719: [PATCH] Pass restart argument to 'kill-emacs-query-functions'

From: Eli Zaretskii <[email-masked]>
Date: Tue, 07 Jan 2025 18:38:04 +0200

> Date: Tue, 07 Jan 2025 15:54:42 +0000
> From: [email-masked]
> Cc: [email-masked], [email-masked]
> 
> > It's a strange (and maybe even dangerous) distinction.
> 
> I'm afraid I don't see this, could you elaborate?
> 
> > But in any case, I think a cleaner solution would be to bind a
> > variable inside restart-emacs, and then your hook could examine it.
> > Alternatively, ...
> > 
> >> > In any case, the prefix argument is available via current-prefix-arg.
> >> 
> >> Yes you're right, I realised after I sent it....
> > 
> > ...you could invoke restart-emacs with a prefix argument, and examine
> > that in your kill-emacs-query-functions hook.  AFAICT, this should
> > work without any changes.
> 
> I'm afraid I also don't follow here, how is that cleaner than 
> introducing
> a specific hook? Rather than needing to specifically modify a function
> to work with the prefix argument, you can just add it to the hook.

It isn't necessarily cleaner, but it is a local solution for what I
consider a local and very specialized problem.  There's no reason to
expect Emacs to have an OOTB solution for every possible niche use
case that some user needs to handle.  Adding a hook means we all have
to pay the price in documenting it, maintaining it, etc.

Each request for adding a new feature should have a solid enough basis
before we must consider it for addition.  FWIW, I don't yet see why
this particular request qualifies.