GNU bug report logs - #79265
[PATCH] Treat point more consistently in PCM completion

Previous Next

Package: emacs;

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

Date: Mon, 18 Aug 2025 18:54:01 UTC

Severity: normal

Tags: patch

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, 79265 <at> debbugs.gnu.org
Subject: bug#79265: [PATCH] Treat point more consistently in PCM completion, [PATCH] Treat point more consistently in PCM completion, [PATCH] Refactor completion-pcm--merge-completions
Date: Mon, 01 Sep 2025 17:24:45 -0400
>> Also, can we just revert the last patch (and add the test(s) that we
>> found in the mean time) so as to make it easier to review patches?
>
> Certainly, the attached patch does that.
>
> (I would have just done the revert directly but I don't have the ability
> to push to the emacs repo)

Sorry, forgot about that.  Pushed, thanks.

>>> +(defun completion-pcm--group-pattern (pattern)
>>> +  "Group together adjacent wildcards in PATTERN."
>>> +  (let (ret)
>>> +    (dolist (elem pattern)
>>> +      (cond
>>> +       ((or (stringp elem) (eq elem 'any-delim))
>>> +        (push elem ret))
>>> +       ((consp (car-safe ret))
>>> +        (setf (car ret) (append (car ret) (list elem))))
>>> +       (t
>>> +        (push (list elem) ret))))
>>> +    (nreverse ret)))
>>
>> Why is `any-delim` not considered a "wildcard"?
>
> Because it's matched by a different regex which only matches
> delimiters.  The idea here is to have one regex subgroup for each
> stretch of wildcards; i.e., for the pattern '("foo" any star point) we
> have the regex "foo(.*)" instead of "foo(.*)(.*)(.*)".  But any-delim
> needs its own regex subgroup since its matched by a different regex.

Ah, I see, thanks.  I was thinking in terms of "needs a subgroup and
a `try-completion`", which `any-delim` does need.  But yeah, it's also
good to collapse any/star/point (also because it can avoid some
pathological regexp matching performance issues, tho I haven't bumped
into them).

> Yes, the return value of completion-pcm--merge-completions is no
> longer in reverse order.

Thanks, makes a lot more sense now.  🙂


        Stefan





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.