[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: completion-styles and moving the minibuffer point

From: Stefan Monnier
Subject: Re: completion-styles and moving the minibuffer point
Date: Sat, 23 Oct 2021 11:19:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Sometimes Emacs moves the cursor automatically to wherever the possible
> input diverges.  I haven't understood when or why this happens, but I'd
> like to have this happen more often.  Does anyone know how?

The code that decides it is in `completion-pcm--merge-try`.

The matching is done basically using "glob" patterns which are sequences
of (sub)strings that need to be matched exactly and wildcard that can
match anything.  There are several different wildcards, tho.
The main ones are:
- `star` used by `partial-completion` to represents an explicit "*" in the input
- `any` means a wildcard that was added by the completion style.
- `point` used to indicate where point is (and is also a wildcard).

The job of completion is then to try and lengthen the substrings without
affecting the set of candidates that match.

When a wildcard only ever matches the empty string, it can be removed.

So, IIRC the minibuffer point is only moved when the `point` wildcard
ends up only matching the empty string (i.e. it gets removed), in which
case point is moved to the nearest (remaining) `any`.

So to try and figure out why point is not moved in your case,
I recommend you try and trace the calls to
`completion-pcm--merge-completions` to better see what's going on.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]