From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: 74420@debbugs.gnu.org
Subject: bug#74420: 31.0.50; PCM completion for ~/src/emacs/trunk/*/minibuf breaks
Date: Mon, 18 Nov 2024 15:39:17 -0500 [thread overview]
Message-ID: <jwvmshwl28r.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <ier34jo1m24.fsf@janestreet.com> (Spencer Baugh's message of "Mon, 18 Nov 2024 12:36:19 -0500")
> 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
next prev parent reply other threads:[~2024-11-18 20:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 17:33 bug#74420: 31.0.50; PCM completion for ~/src/emacs/trunk/*/minibuf breaks Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-18 17:36 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-18 20:39 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-18 22:17 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-18 23:58 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-19 13:18 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvmshwl28r.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=74420@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=sbaugh@janestreet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).