GNU bug report logs -
#77718
31.0.50; completion styles substring and flex are broken
Previous Next
Reported by: Stephen Berman <stephen.berman <at> gmx.net>
Date: Thu, 10 Apr 2025 22:23:02 UTC
Severity: normal
Found in version 31.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Wed, 18 Jun 2025 16:10:11 -0400 Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
>> index 122459be062..598383e7b51 100644
>> --- a/lisp/minibuffer.el
>> +++ b/lisp/minibuffer.el
>> @@ -4516,6 +4516,14 @@ completion--common-suffix
>> "Return the common suffix of the strings STRS."
>> (nreverse (try-completion "" (mapcar #'reverse strs))))
>>
>> +(defcustom completion-/-not-common-suffix nil
>> + "If non-nil, ignore \"/\" as common suffix.
>> +With the substring completion style enabled, this prevents displaying
>> +\"/\" as the common substring suffix when all completion candidate end
>> +in \"/\" (that was the only dispay prior to Emacs 31)."
>> + :version "31.1"
>> + :type 'boolean)
>
> Like Daniel, I'd much rather find a solution that doesn't involve
> a user config.
>
>> (defun completion-pcm--merge-completions (strs pattern)
>> "Extract the commonality in STRS, with the help of PATTERN.
>> PATTERN can contain strings and symbols chosen among `star', `any', `point',
>> @@ -4622,7 +4630,9 @@ completion-pcm--merge-completions
>> (mapcar (lambda (str) (substring str skip))
>> comps))))))
>> (cl-assert (stringp suffix))
>> - (unless (equal suffix "")
>> + (unless (if completion-/-not-common-suffix
>> + (member suffix '("" "/"))
>> + (equal suffix ""))
>> (push suffix res))))
>> ;; We pushed these wildcards on RES, so we're done with them.
>> (setq wildcards nil))
>
> Comments:
>
> - We shouldn't hardcode "/" here, since this code is not specific to
> file names. IOW we should use the `completion-boundaries`
> functionality instead to detect if the suffix is equal to the
> boundary separator.
> - Maybe we can/should limit this "/" special case to the situation where
> `prefix` is empty (or where the string before "suffix" also ends in
> a boundary-separator).
Does the attached patch go in the direction you intended with your
comments? From my initial testing it gives the same results as my patch
with hardcoded "/", and I haven't seen bad results yet; however, I don't
have a good understanding of `completion-boundaries' and may well have
not used it as you meant. Also, even if it does do what you suggested,
since it in effect reverts the substring completion display and behavior
involving directories to what it was before Spencer's changes, I guess
he wouldn't accept it, just as he rejected my first patch. That was why
I proposed to make the behavior configurable, but you don't like that;
why not?
Steve Berman
[Message part 2 (text/x-patch, attachment)]
This bug report was last modified 10 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.