Dmitry Gutov writes: > Spencer, hi, > > On 11/08/2025 19:44, Spencer Baugh wrote: >> Improve completion-pcm-leading-wildcard by actually inserting >> a * when try-completion runs. completion-pcm--merge-try will >> automatically remove the wildcard anywhere that it has no >> matches, so the * is inserted only where it actually had an >> effect. > > Would it be difficult to add a test for this? > > I can see that you authored some of most recent ones in > minibuffer-tests.el, but completion-pcm-leading-wildcard does not seem > to be exercised in our suite yet. Certainly, easy enough to do a basic test, attached. Though, after working on this some more, I think there's a better thing to be doing here, which should always apply to pcm rather than be conditioned on completion-pcm-leading-wildcard: insert a * when a non-* wildcard is matching against an empty string. For example, when doing (completion-pcm-try-completion "a/b" '("a/bbb" "a-test/bbb") nil 3) return "a*/bbb" instead of the current "a/bbb". This matches up with this comment in completion-pcm--merge-completions: ;; FIXME: in some cases, it may be necessary to turn an ;; `any' into a `star' because the surrounding context has ;; changed such that string->pattern wouldn't add an `any' ;; here any more. I tried doing that change instead, and it works pretty nicely, but before landing it I found I had to fix bug#79265 first. So let's settle that one first then come back to this bug.