Subject: bug#54329: 28.0.91; custom-prompt-customize-unsaved-options does not return nil

From: Eli Zaretskii <[email-masked]>
Date: Thu, 10 Mar 2022 19:09:49 +0200

> From: Sebastian Miele <[email-masked]>
> Date: Thu, 10 Mar 2022 17:19:07 +0100
> 
> In an emacs -Q, evaluate
> 
>   (add-hook 'kill-emacs-query-functions
>             'custom-prompt-customize-unsaved-options)
> 
>   (progn
>     ;; Somthing like the following may be done, e.g., by
>     ;; ‘activate-transient-input-method’:
>     (setq default-transient-input-method "TeX")
>     (customize-mark-as-set 'default-transient-input-method))
> 
> and hit C-x C-c.  When asked about whether to examine the unsaved
> options, say yes.
> 
> Expected: Emacs does not terminate, so that I can examine.
> 
> Actual behavior: Emacs terminates.
> 
> The following diff fixes this issue (and a documentation bug):
> 
> diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
> index c2ddaeb7b1..77840c4b65 100644
> --- a/lisp/cus-edit.el
> +++ b/lisp/cus-edit.el
> @@ -1531,12 +1531,11 @@ customize-apropos-groups
>  ;;;###autoload
>  (defun custom-prompt-customize-unsaved-options ()
>    "Prompt user to customize any unsaved customization options.
> -Return non-nil if user chooses to customize, for use in
> +Return nil if user chooses to customize, for use in

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.

Thanks.