Subject: bug#18733: 24.3.94; completion default with icomplete-show-matches-on-no-input t

From: [email-masked]
Date: Wed, 15 Oct 2014 09:23:50 -0500

This bug is related to 17545.

With `icomplete-mode' active, and `icomplete-show-matches-on-no-input'
set to `t', invoking `switch-to-buffer' and then
`minibuffer-force-complete-and-exit' gives confusing results; the buffer
selected is the default specified by `read-buffer-to-switch', which is
often _not_ the first completion displayed, which is what the user
expects.

In particular, if `icomplete-forward-completions' is invoked, the first
displayed completion will not match the default.

Suggested solutions:

In the case of `switch-to-buffer', the default chosen by icomplete is
usually better than that chosen by `read-buffer-to-switch', so a good
solution would be to change `read-buffer-to-switch' to specify a nil
default, at least when some completion mode other than the default is
active.

Alternately, icomplete could set `minibuffer-default' to the first
displayed completion, or to nil; don't set `minibuffer-default' until
a completion is displayed.

In other cases, such as `kill-buffer', there is an obvious default (the
current buffer); then icomplete should force the first completion to be
the specified default. However if the user invokes
`icomplete-forward-completions', the defaults will differ, so
icomplete should set `minibuffer-default'.

In GNU Emacs 24.3.94.8 (x86_64-pc-mingw32)
 of 2014-10-08 on TAKVER
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/mingw32'

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

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  allout-mode: t
  diff-auto-refine-mode: t
  icomplete-mode: t
  display-time-mode: t
  delete-selection-mode: t
  tooltip-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
l t <return> <tab> c h a n g e SPC <down> <down> <down>
<down> <down> <up> <M-left> <M-left> C-SPC <M-right>
<M-right> <M-right> <M-right> <M-delete> <up> <up>
<up> <up> <up> <up> <up> <up> <M-left> <M-left> <M-left>
<insert> <S-right> <S-right> <S-right> <S-right> <S-right>
<S-right> <S-right> <S-right> <S-right> <S-right> <S-right>
<S-right> <S-right> <S-right> <S-right> <S-right> <down>
<down> <down> <down> <insert> SPC t SPC <backspace>
o SPC s p e c i f i <backspace> y SPC n o SPC d e f
a u l t <return> <down> <down> <down> M-` <C-M-up>
<f11> g l o <return> C-SPC <home> <M-delete> <f11>
<return> <prior> C-SPC <next> <M-delete> <C-M-down>
<down> <down> <down> <right> <right> <right> <right>
<right> <right> <right> <right> <M-S-right> e m p t
y SPC s t r i n g SPC <backspace> <up> <up> <up> <up>
<up> <up> <up> <up> <down> <down> <tab> b u t SPC o
n l y SPC i f SPC s o m e SPC c o m p l e t i o n SPC
m o d e SPC i s SPC e n a b l e d ? <return> t h e
r e SPC i s SPC a SPC d f a u l <backspace> <backspace>
<backspace> <backspace> e f a u l t SPC c o m p l e
t i o n SPC m o d e SPC a c t i v e <return> <up> <up>
<up> <end> <return> <tab> l e a f <backspace> v e SPC
d e f a u l t SPC t o SPC c o m p l e t i o n SPC <C-M-up>
<f11> i c o m <return> C-r k e y m a p <up> <up> <up>
<up> M-x M-w r e p o r t <return>

Recent messages:
Auto-saving...done
Mark set [3 times]
M-` is undefined
Auto-saving...
Mark set [2 times]
Auto-saving...done
Auto-saving...done
Mark saved where search started
Saving file c:/home/stephe/projects.text...
Wrote c:/home/stephe/projects.text

Load-path shadows:
/Projects/org.emacs.ada-mode.stephe-1/ada-mode hides c:/Projects/emacs/emacs-24.3.94/lisp/progmodes/ada-mode

Features:
(shadow sort mail-extr emacsbug sendmail dvc-persistence dvc-config
dvc-propagate dvc-state cus-theme eieio-custom wid-browse tree-widget
cus-edit shell pcomplete grep pp allout mm-archive network-stream
starttls url-http tls url-gw url-cache url-auth url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers finder-inf copyright two-column iso-transl
mule-util xmtn-dvc dvc-status dvc-diff edebug dvc-fileinfo diff-mode
xmtn-conflicts derived pcase xmtn-ids xmtn-match xmtn-automate
xmtn-compat parse-time xmtn-run xmtn-basic-io xmtn-base eieio-opt
speedbar sb-image ezimage dframe find-func icomplete help-mode misearch
multi-isearch xgit-core bzr-core xmtn-minimal dvc-log log-edit message
format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils
mailheader pcvs-util vc vc-dispatcher ediff-merg ediff-wind ediff-diff
ediff-mult ediff-help ediff-init ediff-util ediff dvc-unified dvc-tips
ffap thingatpt url-parse auth-source eieio byte-opt bytecomp
byte-compile cconv eieio-core gnus-util mm-util help-fns mail-prsvr
password-cache url-vars add-log dvc-autoloads dvc-core dvc-lisp
dvc-buffers dvc-ui dvc-register dvc-utils dvc-emacs ewoc dvc-defs
dvc-site time delsel cus-start cus-load color-theme cl-macs edmacro
kmacro wid-edit cl gv cl-loaddefs cl-lib noutline outline easy-mmode
iswitchb whitespace dired-x dired-aux dired compile comint ansi-color
ring info easymenu bbdb-autoloads package epg-config time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32
ls-lisp w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32notify w32 multi-tty emacs)

Memory information:
((conses 8 422845 79236)
 (symbols 32 33596 0)
 (miscs 32 991 997)
 (strings 16 64869 6636)
 (string-bytes 1 1631552)
 (vectors 8 30336)
 (vector-slots 4 1341024 41994)
 (floats 8 219 418)
 (intervals 28 6473 2326)
 (buffers 512 45))