GNU bug report logs -
#74772
[PATCH] Consistently add wildcards for completion-pcm-leading-wildcard
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74772 in the body.
You can then email your comments to 74772 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74772
; Package
emacs
.
(Tue, 10 Dec 2024 17:51:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Spencer Baugh <sbaugh <at> janestreet.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 10 Dec 2024 17:51:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: patch
completion-pcm--find-all-completions has two different phases:
First we turn the minibuffer text into a regex and matches
completion alternatives against it. If that finds no matches,
then we strip some text off the completions and minibuffer text
and call ourselves recursively to find completions, then filter
the results with the removed text (converted into a regex).
Because of this, completion-pcm-leading-wildcard had
inconsistent behavior: in the second phase, the filter created
from the removed text would have a leading wildcard. That
effectively adds wildcards in the middle of the minibuffer text
at the start of each "word". But the first phrase created a
regex which had no such wildcards. Thus, the two phases could
get substantially different results.
We fix this by changing completion-pcm-leading-wildcard to
consistently add a leading wildcard for each word. This was
always my intention.
* lisp/minibuffer.el (completion-pcm--string->pattern): Include
a wildcard after each delimter with
completion-pcm-leading-wildcard.
* lisp/minibuffer.el (completion-pcm-leading-wildcard): Update
docs.
* doc/emacs/mini.texi (Completion Styles): Update docs.
In GNU Emacs 29.2.50 (build 11, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.15.12, Xaw scroll bars) of 2024-12-02 built on
igm-qws-u22796a
Repository revision: ddde0f4eead134864c7db775c0aeb93f201c35f6
Repository branch: my-emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.10 (Green Obsidian)
Configured using:
'configure --with-x-toolkit=lucid --without-gpm --without-gconf
--without-selinux --without-imagemagick --with-modules --with-gif=no
--with-tree-sitter --with-native-compilation=aot
PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'
[0001-Consistently-add-wildcards-for-completion-pcm-leadin.patch (text/patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74772
; Package
emacs
.
(Tue, 10 Dec 2024 19:05:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 74772 <at> debbugs.gnu.org (full text, mbox):
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Date: Tue, 10 Dec 2024 12:48:23 -0500
> From: Spencer Baugh via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> (defcustom completion-pcm-leading-wildcard nil
> - "If non-nil, partial-completion completes as if there's a leading wildcard.
> + "If non-nil, partial-completion adds a leading wildcard for each word.
The modified wording is misleading, because it says something that
doesn't really happen (as the rest of the doc string reveals).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74772
; Package
emacs
.
(Tue, 10 Dec 2024 19:15:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 74772 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
>> Date: Tue, 10 Dec 2024 12:48:23 -0500
>> From: Spencer Baugh via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> (defcustom completion-pcm-leading-wildcard nil
>> - "If non-nil, partial-completion completes as if there's a leading wildcard.
>> + "If non-nil, partial-completion adds a leading wildcard for each word.
>
> The modified wording is misleading, because it says something that
> doesn't really happen (as the rest of the doc string reveals).
Okay, how about:
If non-nil, PCM completes as if there's a wildcard before each word.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74772
; Package
emacs
.
(Tue, 10 Dec 2024 19:41:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 74772 <at> debbugs.gnu.org (full text, mbox):
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: 74772 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
> Date: Tue, 10 Dec 2024 14:14:15 -0500
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
> >> Date: Tue, 10 Dec 2024 12:48:23 -0500
> >> From: Spencer Baugh via "Bug reports for GNU Emacs,
> >> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >>
> >> (defcustom completion-pcm-leading-wildcard nil
> >> - "If non-nil, partial-completion completes as if there's a leading wildcard.
> >> + "If non-nil, partial-completion adds a leading wildcard for each word.
> >
> > The modified wording is misleading, because it says something that
> > doesn't really happen (as the rest of the doc string reveals).
>
> Okay, how about:
>
> If non-nil, PCM completes as if there's a wildcard before each word.
Much better, thanks. You could even say
If non-nil, partial-completion behaves as if each word is preceded by wildcard.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74772
; Package
emacs
.
(Tue, 10 Dec 2024 20:06:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 74772 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: 74772 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
>> Date: Tue, 10 Dec 2024 14:14:15 -0500
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> >> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
>> >> Date: Tue, 10 Dec 2024 12:48:23 -0500
>> >> From: Spencer Baugh via "Bug reports for GNU Emacs,
>> >> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> >>
>> >> (defcustom completion-pcm-leading-wildcard nil
>> >> - "If non-nil, partial-completion completes as if there's a leading wildcard.
>> >> + "If non-nil, partial-completion adds a leading wildcard for each word.
>> >
>> > The modified wording is misleading, because it says something that
>> > doesn't really happen (as the rest of the doc string reveals).
>>
>> Okay, how about:
>>
>> If non-nil, PCM completes as if there's a wildcard before each word.
>
> Much better, thanks. You could even say
>
> If non-nil, partial-completion behaves as if each word is preceded by wildcard.
Ok, updated patch:
[0001-Consistently-add-wildcards-for-completion-pcm-leadin.patch (text/x-patch, inline)]
From 09d8d74cabe7157d5e8e89e82b7e8bb9129ca007 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Tue, 10 Dec 2024 12:41:49 -0500
Subject: [PATCH] Consistently add wildcards for
completion-pcm-leading-wildcard
completion-pcm--find-all-completions has two different phases:
First we turn the minibuffer text into a regex and matches
completion alternatives against it. If that finds no matches,
then we strip some text off the completions and minibuffer text
and call ourselves recursively to find completions, then filter
the results with the removed text (converted into a regex).
Because of this, completion-pcm-leading-wildcard had
inconsistent behavior: in the second phase, the filter created
from the removed text would have a leading wildcard. That
effectively adds wildcards in the middle of the minibuffer text
at the start of each "word". But the first phrase created a
regex which had no such wildcards. Thus, the two phases could
get substantially different results.
We fix this by changing completion-pcm-leading-wildcard to
consistently add a leading wildcard for each word. This was
always my intention.
* lisp/minibuffer.el (completion-pcm--string->pattern): Include
a wildcard after each delimter with
completion-pcm-leading-wildcard. (bug#74772)
* lisp/minibuffer.el (completion-pcm-leading-wildcard): Update
docs.
* doc/emacs/mini.texi (Completion Styles): Update docs.
---
doc/emacs/mini.texi | 6 +++---
lisp/minibuffer.el | 17 +++++++++--------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 0fcd24ed79d..8e0d58d0f7c 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -577,9 +577,9 @@ Completion Styles
@vindex completion-pcm-leading-wildcard
If @code{completion-pcm-leading-wildcard} is set to @code{t}, this style
-always acts as if a @dfn{wildcard} is present at the start of the
-minibuffer text, similar to the @code{substring} style. For example,
-@samp{l-m} will complete to @samp{emacs-lisp-mode}.
+always acts as if a @dfn{wildcard} is present at the start of each word
+in the minibuffer text, similar to the @code{substring} style. For
+example, @samp{l-ode} will complete to @samp{emacs-lisp-mode}.
@item emacs22
@cindex @code{emacs22}, completion style
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 2d27fef44ab..a695e4f9f73 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3996,17 +3996,18 @@ completion-pcm--pattern-trivial-p
trivial)))
(defcustom completion-pcm-leading-wildcard nil
- "If non-nil, partial-completion completes as if there's a leading wildcard.
+ "If non-nil, partial-completion behaves as if each word is preceded by 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
+If nil (the default), partial-completion requires each word in a
+matching completion alternative to have the same beginning as each
+\"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."
+at the beginning of each word in a completion alternative, as if a
+wildcard such as \"*\" was present at the beginning of each word. This
+makes partial-completion behave more like the substring completion
+style."
:version "31.1"
:type 'boolean)
@@ -4053,7 +4054,7 @@ completion-pcm--string->pattern
(setq p0 p)
(push (substring string p (match-end 0)) pattern)
;; `any-delim' is used so that "a-b" also finds "array->beginning".
- (setq pending 'any-delim)
+ (setq pending (if completion-pcm-leading-wildcard 'prefix 'any-delim))
(setq p0 (match-end 0))))
(setq p p0))
--
2.39.3
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74772
; Package
emacs
.
(Sat, 21 Dec 2024 09:17:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 74772 <at> debbugs.gnu.org (full text, mbox):
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: 74772 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
> Date: Tue, 10 Dec 2024 15:05:12 -0500
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> From: Spencer Baugh <sbaugh <at> janestreet.com>
> >> Cc: 74772 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
> >> Date: Tue, 10 Dec 2024 14:14:15 -0500
> >>
> >> Eli Zaretskii <eliz <at> gnu.org> writes:
> >>
> >> >> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
> >> >> Date: Tue, 10 Dec 2024 12:48:23 -0500
> >> >> From: Spencer Baugh via "Bug reports for GNU Emacs,
> >> >> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >> >>
> >> >> (defcustom completion-pcm-leading-wildcard nil
> >> >> - "If non-nil, partial-completion completes as if there's a leading wildcard.
> >> >> + "If non-nil, partial-completion adds a leading wildcard for each word.
> >> >
> >> > The modified wording is misleading, because it says something that
> >> > doesn't really happen (as the rest of the doc string reveals).
> >>
> >> Okay, how about:
> >>
> >> If non-nil, PCM completes as if there's a wildcard before each word.
> >
> > Much better, thanks. You could even say
> >
> > If non-nil, partial-completion behaves as if each word is preceded by wildcard.
>
> Ok, updated patch:
Stefan, is this patch okay with you? Any comments?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74772
; Package
emacs
.
(Sat, 21 Dec 2024 14:21:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 74772 <at> debbugs.gnu.org (full text, mbox):
> Stefan, is this patch okay with you? Any comments?
It's OK with me, yes,
Stefan
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Thu, 26 Dec 2024 08:45:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Spencer Baugh <sbaugh <at> janestreet.com>
:
bug acknowledged by developer.
(Thu, 26 Dec 2024 08:45:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 74772-done <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Spencer Baugh <sbaugh <at> janestreet.com>, 74772 <at> debbugs.gnu.org
> Date: Sat, 21 Dec 2024 09:20:33 -0500
>
> > Stefan, is this patch okay with you? Any comments?
>
> It's OK with me, yes,
Thanks, installed on master, and closing the bug.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 23 Jan 2025 12:24:22 GMT)
Full text and
rfc822 format available.
This bug report was last modified 148 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.