unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* completion-styles and moving the minibuffer point
@ 2021-10-21 14:34 Philip Kaludercic
  2021-10-23 15:19 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 2+ messages in thread
From: Philip Kaludercic @ 2021-10-21 14:34 UTC (permalink / raw)
  To: help-gnu-emacs


My completion-styles set to

  '(basic initials partial-completion substring)

which is close to perfect for me.

I find it hard to verbalize an annoyance in understanding when
what completion-styles move the point around in the minibuffer. Maybe an
example might help: When selecting a buffer with C-x b, I might have two
buffers open "*Help*" and "*Bug Help*". Typing "Help<tab>" adds a "*",
but another <tab> does nothing. I have to manually C-a to the beginning
of the input and <tab> again for something to happen.

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?

-- 
	Philip Kaludercic



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: completion-styles and moving the minibuffer point
  2021-10-21 14:34 completion-styles and moving the minibuffer point Philip Kaludercic
@ 2021-10-23 15:19 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-10-23 15:19 UTC (permalink / raw)
  To: help-gnu-emacs

> 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.


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-23 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-21 14:34 completion-styles and moving the minibuffer point Philip Kaludercic
2021-10-23 15:19 ` Stefan Monnier via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).