Subject: bug#63910: 29.0.91; icomplete-mode ignores minibuffer-completion-confirm

From: Manuel Zimmermann <[email-masked]>
Date: Mon, 05 Jun 2023 15:39:42 +0200

The problem is that setting the variable `minibuffer-completion-confirm` to
'confirm is not respected by icomplete-mode.

Steps to reproduce:

1. Evaluate following lines:

(setq minibuffer-completion-confirm 'confirm)
(icomplete-mode)

2. C-x C-f /tmp/non-existent-file

The documentation string of `minibuffer-completion-confirm` states:

  If the value is 'confirm', the user may exit with an input that is not a valid
  completion alternative, but Emacs asks for confirmation.

Since a file is opened which does not exist, I would expect that after pressing
RET the first time, Emacs still stays in the minibuffer and appends [Confirm] at
the end of the line. Only when pressing RET a second time Emacs switches to the
new buffer.

The actual behavior is that Emacs directly switches to the new buffer without
confirmation after pressing RET for the first time.

In GNU Emacs 29.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-06-05 built on host-1
Repository revision: dd2d8ff2f5cf5f495a793c7db0a168474a339613
Repository branch: makepkg
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-libotf --without-m17n-flt --without-gconf
 --with-native-compilation=yes --with-xinput2 --with-pgtk
 --without-xaw3d --with-sound=no --with-tree-sitter --without-gpm
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK
PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP XIM GTK3 ZLIB

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

Major mode: ELisp/d

Minor modes in effect:
  icomplete-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(cl-print face-remap misearch multi-isearch bug-reference find-func
shortdoc help-fns radix-tree xref ring gnutls network-stream nsm vc-git
diff-mode easy-mmode vc-dispatcher thingatpt project mailalias smtpmail
textsec uni-scripts url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util url-parse
auth-source eieio eieio-core json map byte-opt url-vars idna-mapping
ucs-normalize uni-confusable textsec-check pp shadow sort mail-extr
emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml
mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils icomplete cl-loaddefs comp
comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode
bytecomp byte-compile cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win pgtk-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 seq simple cl-generic
indonesian philippine 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
theme-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 dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 291917 41682)
 (symbols 48 9945 7)
 (strings 32 56481 2760)
 (string-bytes 1 1397918)
 (vectors 16 52625)
 (vector-slots 8 879756 35852)
 (floats 8 165 141)
 (intervals 56 2071 1022)
 (buffers 984 19))