Subject: bug#1206: double slash // in read-shell-command completion

From: Mauro Aranda <[email-masked]>
Date: Sat, 15 Feb 2025 10:33:59 -0300

Hi Eli,

Eli Zaretskii <[email-masked]> writes:

 >> From: Glenn Morris <[email-masked]>
 >> Cc: [email-masked]
 >> Date: Tue, 01 Mar 2011 23:14:15 -0500
 >>
 >>
 >> Do you still see this? I don't think I do.
 >
 > No, but it still isn't right: it inserts an extra slash. That is, I
 > get something like "d:/gnu/emacs-foo//lisp".  The extra slash in this
 > situation is really not nice...
 >
 > This happens both with Emacs 23.3 RC1 and with the development trunk.

This is an old bug report you filed, that I used to be able to reproduce
years ago when I was looking for old bugs to fix.

Thing is, I'm not able to reproduce it anymore.  I did this:

In a directory that looks like this:
.
├── emacs
│   ├── emacs-27
│   │   ├── lisp
│   ├── emacs-28
│   │   ├── lisp
│   ├── emacs-29
│   │   ├── lisp

emacs -Q
M-!
ls ~/emacs/emacs-2/lisp
Move point to the slash before "lisp".
TAB

Emacs shows:
3 possible completions:
emacs-27/
emacs-28/
emacs-29/

Select one and now the minibuffer shows:
~/emacs/emacs-27/lisp

Emacs 28 shows the behavior you reported.  Then Emacs 29 showed: "No
match", which is wrong.  But then, after the following commit, I can't
reproduce it anymore:

commit ff3f17ca3cdd9e82355942f577e7807acc76ddcd
Author: Dmitry Gutov <[email-masked]>
Date:   Thu May 9 05:30:32 2024 +0300

     choose-completion: Retain the suffix after completion boundary

     * lisp/minibuffer.el (completion-base-suffix):
     Remove as not optimal after all (bug#48356).
     (completion--replace): Use insert-before-markers-and-inherit.
     (minibuffer-completion-help): Don't set completion-base-affixes,
     implement the same logic more optimally by local search and
     querying for field boundaries.  Also fix the problem with
     completion table, predicate and extra-props being looked up in the
     wrong buffer.
     (minibuffer-next-completion, minibuffer-choose-completion):
     Don't bind completion-use-base-affixes anymore.

     * lisp/simple.el (completion-base-affixes)
     (completion-use-base-affixes): Remove.
     (completion-list-insert-choice-function):
     Don't pass them through anymore.