Subject: bug#13602: 24.3.50; remove bindings for `icomplete-minibuffer-map' - make a separate mode

From: Juri Linkov <[email-masked]>
Date: Thu, 07 Feb 2013 09:50:10 +0200

> `completion-all-sorted-completions' prefers recent input history.  Once
> you have `gnus-read-ephemeral-emacs-bug-group' in the command history,
> it is likely to be the first of the few completions which you can pick
> with one or more C-s-es.
>
> One doesn't need to rely on traditional "C-r" exclusively to accomplish
> the above work flow.

IIUC, it matches only prefixes, whereas traditional Isearch `C-r'
can also match in the middle of the command name in the history.

When I tried now `icomplete-backward-completions' currently bound to `C-r',
I discovered that it is broken.  It fails with the error:

Debugger entered--Lisp error: (wrong-type-argument listp 0)
  cdr(0)
  (setcdr last-but-one (cdr last))
  (progn (setcdr last-but-one (cdr last)) ...)
  (if last (progn (setcdr last-but-one (cdr last)) ...))
  (let* ((comps (completion-all-sorted-completions))  (last (cdr last-but-one))) ...)
  icomplete-backward-completions()
  call-interactively(icomplete-backward-completions nil nil)
  read-from-minibuffer("M-x " nil ... nil extended-command-history nil nil)
  completing-read-default("M-x " ... commandp t nil extended-command-history nil nil)
  completing-read("M-x " ... commandp t nil extended-command-history)
  read-extended-command()
  byte-code("..." [current-prefix-arg read-extended-command] 2)
  call-interactively(execute-extended-command nil nil)

The full test case:

0. emacs -Q
1. M-x icomplete-mode RET
2. M-x icomplete-m C-r

Does this mean that other users of `icomplete-mode' like me disabled
`icomplete-mode' in their .emacs after it began overriding Isearch keys,
so this feature remained untested and the bug remained unnoticed
for the long time (2 months)?  I won't be surprised if this is
the real reason, because traditional Isearch C-s and C-r is useful
in the minibuffer.

OTOH, I believe the users of `icomplete-mode' might like the new feature
provided by the new commands `icomplete-forward-completions' and
`icomplete-backward-completions' only when it leaves intact the
traditional Isearch keybindings C-s and C-r.

Let's face the root of the problem: abusing C-s and C-r keys in ido was
a poor choice in the first place that paved the road to future conflicts.
Are there know alternatives to C-s and C-r among the ido users?
I see that ido.el mentions the right and left arrow keys.
Could they be used with some modifiers?