unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sebastian Miele <iota@whxvd.name>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 54329@debbugs.gnu.org
Subject: bug#54329: 28.0.91; custom-prompt-customize-unsaved-options does not return nil
Date: Thu, 10 Mar 2022 18:17:02 +0100	[thread overview]
Message-ID: <87v8wlg05i.fsf@whxvd.name> (raw)
In-Reply-To: <835yolentu.fsf@gnu.org>

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	other threads:[~2022-03-10 17:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 16:19 bug#54329: 28.0.91; custom-prompt-customize-unsaved-options does not return nil Sebastian Miele
2022-03-10 17:09 ` Eli Zaretskii
2022-03-10 17:17   ` Sebastian Miele [this message]
2022-03-10 18:29     ` Eli Zaretskii
2022-03-10 18:55       ` Sebastian Miele
2022-03-10 19:55         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8wlg05i.fsf@whxvd.name \
    --to=iota@whxvd.name \
    --cc=54329@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).