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

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
 `kill-emacs-query-functions'."
   (not (and (custom-unsaved-options)
            (yes-or-no-p "Some customized options have not been saved; Examine? ")
-           (customize-unsaved)
-           t)))
+           (prog1 t (customize-unsaved)))))

 ;;; Buffer.

Best wishes,
Sebastian Miele

In GNU Emacs 28.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.4)
 of 2022-03-10 built on huette
Repository revision: d184773c2e2a69bea9b96190c83727b4e7a16542
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Arch Linux

Configured using:
 'configure --with-x-toolkit=gtk3 --with-mailutils --with-cairo'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE
XIM XPM GTK3 ZLIB

Important settings:
  value of $LC_CTYPE: de_DE.UTF-8
  value of $LANG: C
  locale-coding-system: utf-8-unix

Major mode: mu4e:main

Minor modes in effect:
  vertico-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  savehist-mode: t
  recentf-mode: t
  global-so-long-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  overwrite-mode: overwrite-mode-binary

Load-path shadows:
/home/w/usr/emacs/helpful/helpful hides /home/w/.config/emacs/usr/helpful-20220220.2308/helpful
/home/w/.config/emacs/usr/transient-20220307.2129/transient hides /home/w/usr/emacs/0/.0/lisp/transient

Features:
(shadow emacsbug macrostep-c cmacexp pulse xref dired-aux face-remap
bug-reference cus-edit cus-start calc-map calc-stat calc-vec calc-ext
calc-menu calc-aent calc calc-loaddefs rect calc-macs misearch
multi-isearch tabify cal-move consult-org vc-git vc-dispatcher saveplace
oc-basic disp-table ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus
nnselect gnus-search eieio-opt speedbar ezimage dframe ol-docview
ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi whx-init::later mu4e
mu4e-org mu4e-main mu4e-view mu4e-view-gnus gnus-art mm-uu mml2015
mm-view mml-smime smime dig gnus-sum gnus-group gnus-undo gnus-start
gnus-dbus dbus gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
gnus-spec gnus-int gnus-range gnus-win mu4e-view-common mu4e-headers
mu4e-compose mu4e-context mu4e-draft mu4e-actions ido rfc2368 smtpmail
sendmail mu4e-mark mu4e-proc mu4e-utils doc-view jka-compr image-mode
exif mu4e-lists mu4e-message flow-fill mule-util hl-line mu4e-vars
mu4e-meta apache-mode systemd pkgbuild-mode flymake-proc flymake project
warnings cmake-font-lock cmake-mode rst gitignore-mode gitconfig-mode
conf-mode gitattributes-mode sh-script executable lua-mode json-mode
json-snatcher js cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs yaml-mode vcard css-mode smie
sgml-mode facemenu eww url-queue shr kinsoku svg xml dom mm-url gnus
nnheader markdown-mode color thingatpt tex-mode compile ob-shell
org-bullets ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util
rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
ox-icalendar org-agenda ox-html table ox-ascii ox-publish ox ace-window
avy consult-vertico consult magit-bookmark bookmark orderless vertico
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode diff diff-mode git-commit log-edit message rmc puny rfc822
mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor magit-mode magit-git magit-base magit-section
crm diary-lib diary-loaddefs cal-iso helpful imenu trace edebug
info-look f elisp-refs man dired dired-loaddefs descr-text tramp-sh
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
shell parse-time iso8601 ls-lisp server whx::safe-local whx-etc::0
whx::transient whx::arg whx::plist whx::list transient cl-extra
whx::elpa whx-boot-lib::elpa whx-etc::org whx-etc::org-link
whx-etc::org-password whx::password whx::pcase whx::walk org-element
org-persist xdg org-id org-refile avl-tree generator whx-etc::org-hide
cus-load org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color
org-list org-faces org-entities org-version ob-emacs-lisp ob-core
ob-eval org-table ol org-keys oc org-compat advice org-macs org-loaddefs
format-spec cal-menu calendar cal-loaddefs whx-etc::elisp whx::elisp
whx::string s whx::feature dash debug backtrace find-func macrostep pp
whx-etc::gc edmacro kmacro whx::binary-unit-prefix whx::bind whx::log
whx::meta whx::cl whx::error whx-etc::session savehist recentf
tree-widget wid-edit whx-etc::custom whx-etc::core-settings so-long
noutline outline easy-mmode diminish no-littering
whx-etc::modus-operandi whx-etc::modus-operandi-theme
modus-operandi-theme whx::custom modus-themes time-date finder-inf
geiser-impl help-fns radix-tree help-mode geiser-custom geiser-base ring
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source eieio eieio-core eieio-loaddefs password-cache
json map url-vars seq byte-opt bytecomp byte-compile cconv
whx-init::early whx-boot whx-boot::run-level whx-boot-etc::run-level
cl-seq whx-boot-etc::packages whx-boot-etc::directories
whx-boot::after-init-hook whx-boot-etc::core-settings
whx-boot-lib::custom whx-boot-lib::fs-path subr-x whx-boot-lib::symbol
whx-boot::session-type whx-boot::verbosity whx-boot-lib::log
whx-boot::early-cmdline whx-boot-lib::string rx whx-boot-lib::feature
whx-boot-lib::0 info whx-boot-lib::list whx-boot-lib::meta
whx-boot-lib::pcase pcase whx-boot-lib::error cl-macs gv cl-loaddefs
cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 796178 377838)
 (symbols 48 59796 95)
 (strings 32 239722 35837)
 (string-bytes 1 7038659)
 (vectors 16 93521)
 (vector-slots 8 2209654 370338)
 (floats 8 569 1111)
 (intervals 56 13204 6070)
 (buffers 992 26))