GNU bug report logs -
#74420
31.0.50; PCM completion for ~/src/emacs/trunk/*/minibuf breaks
Previous Next
Reported by: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Mon, 18 Nov 2024 17:34:01 UTC
Severity: normal
Tags: patch
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
Message #11 received at 74420 <at> debbugs.gnu.org (full text, mbox):
> An explicitly typed * has different semantics from automatically
> inserted PCM wildcards, so it should be preserved on
> try-completion. We already do this in some cases, but now we do
> it more. Concretely, we do it by optimizing the PCM pattern
> more aggressively to avoid having multiple wildcards in a row:
> after those are removed, the existing code in
> completion-pcm--merge-completions is able to preserve * in more
> cases.
Oh, indeed, thank you.
The patch looks good to me, so if there are no objection, I'll install
it in a few days (feel free to ping me if I forget).
Banter follows.
> * lisp/minibuffer.el (completion-pcm--optimize-pattern): Add
> more optimizations. (bug#74420)
Aha, so that's why you didn't submit the patch together with the initial
bug report!
> - (`(,(or 'any 'any-delim) ,(or 'any 'point) . ,_)
> - (setq p (cdr p)))
> + ;; Remove duplicate `any' and `prefix'
> + (`(any any . ,rest)
> + (setq p (cons 'any rest)))
> + (`(prefix prefix . ,rest)
> + (setq p (cons 'prefix rest)))
> + ;; `any' matches anything `any-delim' does, and grows the same way.
> + (`(any-delim any . ,rest)
> + (setq p (cons 'any rest)))
AFAICT you can still merge the `any-delim any` and `any any` cases.
> + ;; Remove other wildcards found around `star' or `point'.
> + ((or `(,(and keep (or 'star 'point)) ,(or 'any 'any-delim 'prefix) . ,rest)
> + `(,(or 'any 'any-delim 'prefix) ,(and keep (or 'star 'point)) . ,rest))
> + (setq p (cons keep rest)))
BTW, maybe we should go with something like
(`(,(and (pred symbolp) s1) ,(and (pred symbolp) s2) . ,rest)
(cond ((completion-pcm--<something>-p s1 s2) (setq p (cons s1 rest)))
((completion-pcm--<something>-p s2 s1) (setq p (cons s2 rest)))
(t (push (pop p) n))))
Where `completion-pcm--<something>-p` is some kind of partial ordering?
Stefan
This bug report was last modified 100 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.