GNU bug report logs - #70217
[PATCH] Add substring-partial-completion style

Previous Next

Package: emacs;

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

Date: Fri, 5 Apr 2024 12:43:02 UTC

Severity: wishlist

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70217 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: bug#70217: [PATCH] Add substring-partial-completion style
Date: Tue, 28 May 2024 16:01:53 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: 70217 <at> debbugs.gnu.org,  monnier <at> iro.umontreal.ca
>> Date: Tue, 28 May 2024 14:51:37 -0400
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> >> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> >> Cc: 70217 <at> debbugs.gnu.org,  monnier <at> iro.umontreal.ca
>> >> Date: Tue, 28 May 2024 14:16:30 -0400
>> >> 
>> >> > and (b) please do not use examples with repeated characters, because
>> >> > they can lead readers to make the wrong conclusions due to accidental
>> >> > situations.  For example, AFAIU valid candidates for "b*/c*" include
>> >> > "bcdxyz/c1234" and also "b/x/y/z/c/1/2/3", but readers might
>> >> > mistakenly think that "b*" stands for a string made only of "b", or
>> >> > that there can be only one slash and it must precede "c".  Avoiding
>> >> > repeated characters prevents such misunderstandings.
>> >> 
>> >> Excellent point, fixed.
>> >
>> > Thanks.
>> >
>> >> > But please (a) don't use "glob" and file wildcard notation, use
>> >> > regexps instead;
>> >> 
>> >> True, I removed the word "glob", I agree that's confusing since
>> >> e.g. [a-z] or {foo,bar} are valid globs but not valid in
>> >> partial-completion.
>> >> 
>> >> Note however that "*" is literally valid syntax with partial-completion,
>> >> where as the regexp notation (".*") is not.  The partial-completion
>> >> documentation already mentions this in (info "(emacs) Completion
>> >> Styles").  So I slightly reworded it and continued using "*".
>> >
>> > Please don't.  I really meant what I wrote: "glob" is confusing to
>> > users, because of the file-name wildcards connotation.
>> >
>> > The natural way of describing string patterns in Emacs is regular
>> > expressions, not globs.
>> 
>> Just to be clear, if you type C-h v ffap-*-path TAB it will complete to
>> variables whose name starts with "ffap-" and end with "-path".  This is
>> a partial-completion feature which has nothing to do with globs.
>> 
>> I agree that the natural way of describing string patterns in Emacs is
>> regular expressions, not globs.  There are no globs in this docstring.
>> I am mentioning only * which is what partial-completion natively
>> supports.  * has nothing to do with globs, it is a feature of
>> partial-completion which is similar but distinct from shell globs.
>> 
>> partial-completion works in terms of * not regular expressions, so it
>> would be confusing to use a regular expression here.
>
> I know.  But you are not talking about partial completion in that
> text, you are talking about strings that match or don't match.  The
> natural way of describing those is regular expressions.

Okay, I'll remove mention of matching, and try to make it clear that I'm
just talking about completion.  How about one of the following two
options?


  If non-nil, partial-completion completes as if there's a leading wildcard.

If nil (the default), partial-completion requires a matching completion
alternative to have the same beginning as the first "word" in the
minibuffer text, where "word" is determined by
`completion-pcm-word-delimiters'.

If non-nil, partial-completion allows any string of characters to occur
at the beginning of a completion alternative, as if a wildcard such as
"*" was present at the beginning of the minibuffer text.  This makes
partial-completion behave more like the substring completion style.


Or:


  If non-nil, partial-completion completes as if there's a leading wildcard.

partial-completion interprets "*" as a wildcard, replacing it with any
string of characters while completing.  partial-completion also adds
wildcards before characters in `completion-pcm-word-delimiters', and
adds a wildcard at the end of the minibuffer text; the behavior is
identical to typing "*" at all of those sites.

If nil (the default), "a/b" will complete the same as if you had typed
"a*/b*".

If non-nil, partial-completion additionally adds a wildcard at the start
of the string; then "a/b" will complete the same as if you had typed
"*a*/b*".  This makes partial-completion behave more like the substring
completion style.




This bug report was last modified 328 days ago.

Previous Next


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