Subject: save-buffers-kill-emacs doesn't give a visible prompt when called from command line

From: Peter Ludemann <[email-masked]>
Date: Mon, 23 May 2022 12:56:17 -0700

When I try to kill an emacs server from the command line by:
   emacsclient -e '(save-buffers-kill-emacs)'
nothing appears to happen if there are any unsaved buffers.

I presume that this is because the prompt goes to the usual place (below
the mode line in the screen), which of course isn't visible from the
command line because there isn't any screen when using "emacsclient -e".

This is a follow-up to bug 55560, where it was suggested that kill-emacs is
inappropriate and instead I should use save-buffers-kill-emacs.

Probably not relevant, but including for completeness:

I have the following "my-exit" function added to
kill-emacs-query-functions; I've confirmed that this use of daemonp behaves
as expected and that the "Really kill Emacs?" prompt doesn't happen:

(defun my-exit ()
  (or (daemonp)
      (yes-or-no-p "Really kill Emacs? ")))

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll
bars)
 of 2022-05-21 built on penguin
Repository revision: 208102fa470e3417320062cdb48a9967d80bf092
Repository branch: master
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --prefix=/home/peter/.local --with-gnutls
 PKG_CONFIG_PATH=/home/peter/.local/lib/pkgconfig:'

Configured features:
FREETYPE GIF GMP GNUTLS JPEG LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XAW3D XDBE
XFT XIM XPM LUCID ZLIB

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

Major mode: Apropos

Minor modes in effect:
  global-auto-revert-mode: t
  display-time-mode: t
  savehist-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
~/src/pykythe/emacs/prolog hides
/home/peter/.local/share/emacs/29.0.50/lisp/progmodes/prolog

Features:
(shadow sort mail-extr emacsbug message yank-media rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils shortdoc help-fns radix-tree misearch
multi-isearch mule-util apropos time-date term/xterm xterm finder-inf
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 cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars cl-extra help-mode seq gv subr-x
byte-opt bytecomp byte-compile cconv autorevert filenotify grep compile
text-property-search comint ansi-color ring cus-load time savehist
desktop frameset 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 nadvice simple 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 abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads inotify
dynamic-setting font-render-setting x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 91186 8875)
 (symbols 48 9960 1)
 (strings 32 29163 1620)
 (string-bytes 1 904097)
 (vectors 16 15493)
 (vector-slots 8 175522 6636)
 (floats 8 79 477)
 (intervals 56 533 0)
 (buffers 992 12))