GNU bug report logs - #62700
29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Thu, 6 Apr 2023 17:57:01 UTC

Severity: normal

Found in version 29.0.60

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62700 <at> debbugs.gnu.org, Spencer Baugh <sbaugh <at> janestreet.com>, juri <at> linkov.net
Subject: bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer
Date: Thu, 06 Apr 2023 16:42:13 -0400
>> > I think it's the intended behavior.  In this case, it looks not
>> > useful, because the string you typed before starting to use M-<UP> and
>> > M-<DOWN> happens to be at the end of each completion candidate.  But
>> > this is not the only situation possible.  Basically, completion always
>> > modifies only the text before point, leaving what's after point
>> > intact, so that the user could have after point stuff that completion
>> > should ignore, and that eventually will be appended to the selected
>> > candidate.
>> 
>> Could you give an example of when this would be desirable?
>
> When completing on shell commands, for example: the text after point
> is usually the command-line arguments to the command, and the
> completion is on command names or on some file name.

That shouldn't be a worry: when you complete shell commands, you're not
really using "minibuffer completion" (as is the case in `C-h v`) but
"in-buffer completion" (i.e. TAB is bound to `completion-at-point`
rather than to `minibuffer-complete`), so the completion code knows that
you're only completing the command part and will (hopefully) be careful
not to touch anything before or after it.

More specifically, in `M-!` if you're at

    echo hello; e!s world

where `!` shows where point is, the *Completions* buffer should show all
command that start with `e` and end in `s` (assuming we're using
`basic` or `partial-completion` styles) and if you use
minibuffer-{previous,next,choose}-completion, they should replace `e!s`
with the selection.  IOW it should neither "leave the text after point
alone" nor "replace all the text after point".

>> For example, suppose I wanted to wanted to complete filenames starting
>> with x and ending in .c.
> I don't think the default completion supports such functionality, at
> least not with the styles we have by default in completion-styles.

The behavior Spencer describes is very much part of our default (it's
provided both by the `basic` and the `partial-completion` styles, both
of which are enabled by default).


        Stefan





This bug report was last modified 1 year and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.