Subject: bug#67661: 30.0.50; *Completions* has started popping up for icomplete-in-buffer

From: Sean Whitton <[email-masked]>
Date: Fri, 29 Dec 2023 20:24:26 +0000

Hello,

On Fri 29 Dec 2023 at 09:27pm +02, Eli Zaretskii wrote:

> To which entry in Emacs 29's NEWS would this be related?

I'm talking about how Juri fixed icomplete-in-buffer for Emacs 29, and
how it's now working differently.  Juri's fix wasn't noted in NEWS.29,
so there isn't a relevant entry.

Let me lay out where I think things stand now that the confounding
Pcomplete bug is fixed.  Here are four reproductions:

,----
|
| 1. emacs -q
| 2. (setopt icomplete-in-buffer t
|            completion-auto-help 'lazy)
| 3. M-x icomplete-mode
|
|
| 4a. M-x eshell
| 5a. cd ~/src/emacs/<RET>
| 6a. ls<SPC>l<TAB>
|     - Emacs 29: in-buffer Icomplete appears
|     - Emacs 30: nothing happens
| 7a. <TAB> a second time
|     - Emacs 29: *Completions* pops up
|     - Emacs 30: in-buffer Icomplete appears & *Completions* pops up
|
|
| 4b. Insert text into *scratch*: (setopt icomplete-
| 5b. C-M-i
|     - Emacs 29: in-buffer Icomplete appears
|     - Emacs 30: nothing happens
| 6b. C-M-i a second time
|     - Emacs 29: accepts the completion
|     - Emacs 30: in-buffer Icomplete appears & *Completion* pops up
|
|----
|
| 1. emacs -q
| 2. (setopt icomplete-in-buffer t)
| 3. M-x icomplete-mode
|
|
| 4a. M-x eshell
| 5a. cd ~/src/emacs/<RET>
| 6a. ls<SPC>l<TAB>
|     - Emacs 29: in-buffer Icomplete appears
|     - Emacs 30: in-buffer Icomplete appears & *Completions* pops up
| 7a. <TAB> a second time
|     - Emacs 29: *Completions* pops up
|     - Emacs 30: n/a
|
|
| 4b. Insert text into *scratch*: (setopt icomplete-
| 5b. C-M-i
|     - Emacsen 29 & 30: in-buffer Icomplete appears & *Completions* pops up.
|----

We could see this as two incompatible changes to icomplete-in-buffer
since Emacs 29:

A. completion-auto-help now controls whether C-M-i or <TAB> must be
   typed twice to display in-buffer Icomplete.
   Previously, completion-auto-help affected only minibuffer completion.
   I must have been thinking of it this way when I set it to `lazy'.

B. *Completions* now always appears at the same time as the in-buffer
   Icomplete.  Previously, in some cases, it would appear only after
   typing C-M-i or <TAB> twice.

An Icomplete user like me is likely to want to respond to both these
changes.  The worst case is how nothing happens after a single <TAB> in
the first reproduction, such that typing two <TAB>s is always required.

Thus, I propose adding a NEWS.30 entry like this:

    There have been some changes which normalise some behaviour of
    in-buffer completion that affect users of icomplete-in-buffer.

    Firstly, completion-auto-help now governs icomplete-in-buffer,
    whereas previously it affected only minibuffer completion.  You may
    wish to review any existing customisation for completion-auto-help
    if in-buffer completion behaves in a way that surprises you.

    Secondly, the *Completions* buffer now always pops up at the same
    time that Icomplete displays its in-buffer completion.  If you would
    prefer to see only Icomplete's display, which is what you might be
    used to, you could use

        (advice-add 'completion-at-point :after #'minibuffer-hide-completions)

The reason I haven't gone ahead and added this already is that Juri has
suggested further changing icomplete-in-buffer's default behaviour.
I don't think that we should do that.

-- 
Sean Whitton