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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 06 Apr 2023 21:22:42 +0300

> Cc: Juri Linkov <[email-masked]>
> From: Spencer Baugh <[email-masked]>
> Date: Thu, 06 Apr 2023 13:56:35 -0400
> 
> 6. C-h v -path
> 7. C-a to move point to before -path
> 8. <tab> to show completions of variables ending in -path
> 9. Use M-<up> and M-<down> to switch between completions.  Now as you
> switch completions, they are inserted at point, *without* replacing the
> text already in the buffer.  So e.g. the minibuffer will contain
> "load-path-path".
> 10. Likewise, if you (setq minibuffer-completion-auto-choose nil), M-RET
> inserts the completion string at point, without replacing the text in
> the minibuffer, so you will get "load-path-path".
> 
> I think this is basically just a bug.

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.

> Hopefully we can fix this before Emacs 29 is released, because this
> is the last thing which stops these new commands from being a really
> great improvement to the Emacs completion defaults.

Why did you need to move point to the beginning of what you typed to
begin with?  Unless you explain that, I don't see how we can consider
this issue important enough to fix at all, let alone for Emacs 29.

> If this is intentional for some reason, I think the behavior should
> definitely be changed before Emacs 29 is released.  Moving point around
> in the minibuffer while completing is an important part of using the
> default completion-styles

It is? why?