bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54329: 28.0.91; custom-prompt-customize-unsaved-options does not ret


From: Sebastian Miele
Subject: bug#54329: 28.0.91; custom-prompt-customize-unsaved-options does not return nil
Date: Thu, 10 Mar 2022 18:17:02 +0100

Hi Eli,

Eli Zaretskii <eliz@gnu.org>:
> If you want to prevent Emacs from terminating, you can simply return
> nil from your hook function.  I see no reason to change the semantics
> of the return value for a single use case: this function was evidently
> assuming a different use case, and it exists in this shape long enough
> to prevent us to change its behavior in such a radical way.

This is not about me wanting to change the behavior of
‘custom-prompt-customize-unsaved-options’.  It definitely is a bug in
Emacs 28.  The definition

  (defun custom-prompt-customize-unsaved-options ()
    (not (and (custom-unsaved-options)
              (yes-or-no-p "Some customized options have not been saved; 
Examine? ")
              (customize-unsaved)
              t)))

seems to be unchanged from Emacs 27.2 to Emacs 28.  However, in Emacs
27.2, it did work as I expect and as I understand the Emacs manual:

  Please note that any customizations you have not chosen to save for
  future sessions will be lost when you terminate Emacs.  If you’d
  like to be prompted about unsaved customizations at termination
  time, add the following to your initialization file:

       (add-hook 'kill-emacs-query-functions
                 'custom-prompt-customize-unsaved-options)

(For ‘custom-prompt-customize-unsaved-options’ to have a/the sensible
meaning as a member of ‘kill-emacs-query-functions’, it must return
nil when there are unsaved options and the user answered "yes".)

The reason that the behavior of
‘custom-prompt-customize-unsaved-options’ changed from version 27.2 to
28 almost certainly is the following:

‘custom-prompt-customize-unsaved-options’ calls ‘customize-unsaved’
which ends with call to ‘custom-buffer-create’.  The definition of
‘custom-buffer-create’ changed from Emacs 27.2 to Emacs 28.  In Emacs
27.2 it probably always returned non-nil.  In Emacs 28 it always
returns nil.

However, the (and ...) form in
‘custom-prompt-customize-unsaved-options’ depends on
‘customize-unsaved’ to always return non-nil in order to be correct.

‘custom-prompt-customize-unsaved-options’ always had the bug reported
here.  It just did not manifest before ‘custom-buffer-create’ was
changed from Emacs 27.2 to Emacs 28.

Best wishes,
Sebastian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]