GNU bug report logs -
#79265
[PATCH] Treat point more consistently in PCM completion
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Thu, 21 Aug 2025 04:05:38 +0300
with message-id <0a5e4c88-2b50-4a69-b1db-845a41f234cb <at> gutov.dev>
and subject line Re: bug#79265: [PATCH] Treat point more consistently in PCM completion
has caused the debbugs.gnu.org bug report #79265,
regarding [PATCH] Treat point more consistently in PCM completion
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
79265: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79265
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Tags: patch
Properly fix bug#38458, which is fundamentally an issue with
completion-ignore-case, by checking if the completions are
unique ignoring case. When the completions are unique, the
normal code to delete a wildcard naturally causes point to be
moved to the end of the minibuffer, which is the correct
behavior.
Now that the bug is fixed properly, remove a hack which
previously was used to "fix" it, which made point behave
inconsistently if it was in the middle of the minibuffer versus
at the end of the minibuffer.
* lisp/minibuffer.el (completion-pcm--merge-completions):
Respect completion-ignore-case when checking for completion
uniqueness.
(completion-pcm--string->pattern)
(completion-pcm--optimize-pattern): Allow point at the end of
the pattern.
* test/lisp/minibuffer-tests.el (completion-table-test-quoting)
(completion-test--pcm-bug38458, completion-pcm-test-8): Update
tests for more correct behavior.
In GNU Emacs 30.1.90 (build 9, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.15.12, Xaw scroll bars) of 2025-08-14 built on
igm-qws-u22796a
Repository revision: 6adc26ffa74aedbd1cfa9a1ee72073ebccea2b96
Repository branch: emacs-30
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-cairo --with-rsvg --without-compress-install --with-tree-sitter
--with-native-compilation=aot
PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'
[0001-Treat-point-more-consistently-in-PCM-completion.patch (text/patch, attachment)]
[Message part 5 (message/rfc822, inline)]
On 20/08/2025 17:35, Spencer Baugh wrote:
>> So IDK - maybe it's better to use the alien cl-loop, or maybe to go
>> back to seq-some, if no measurements show a cause for worry.
>
> Eh, I went back to seq-every-p for now. This shouldn't really cause a
> performance problem, since it will usually just return nil quickly.
> Also it's only run when the user hits TAB.
Sounds good. Its overhead it two dynamic dispatches, so probably fine
for most uses.
> (I'd rather not use cl-loop, this code is already hard enough to
> understand :) )
All right then. (I like cl-loop ;-( )
>> Just to check: in our limited test examples all elements of COMP match
>> PREFIX already. And the beginning of
>> 'completion-pcm--merge-completions' even 'error'-s if string-match
>> comparison fails.
>>
>> So it's possible that we could omit this comparison from the lambda:
>>
>> (and (string-prefix-p prefix comp completion-ignore-case)
>>
>> But I suppose that would make it a bigger change, a bit riskier.
>
> Ah, you're right. I missed that we already have this property
> guaranteed, but indeed we do.
>
> So thanks to that, the change can be further simplified. Removing my
> cond refactoring, the patch is now just replacing
>
> (eq t (try-completion prefix comps))
>
> with
>
> (seq-every-p
> (lambda (comp) (= (length prefix) (length comp)))
> comps)
>
> which is a nice simple change. I added some comments to clarify why
> this is correct, too.
Thanks, pushed to master, this and the the following patch (nice
optimization!).
And with that, time to close.
This bug report was last modified 9 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.