Spencer Baugh writes: > Stefan Monnier writes: >>> - (while (setq next (match-end i)) >>> - (push (substring str last next) chopped) >>> - (setq last next) >>> + (while (setq next (match-string i str)) >>> + (push next chopped) >> >> IIUC this means that when `completion-ignore-case` is t we will keep the >> capitalization typed by the user rather than adjust it based on the >> completion candidates. >> >> E.g. >> >> (let ((completion-ignore-case t)) >> (completion-pcm--merge-completions '("ABC" "ABD") '("a"))) >> >> will complete "a" to "aB" rather than to "AB". >> >> See commit 681e0e7c02c4f8ff6d316c8c24001106cb847023 (which should have >> come with a regression test, obviously). > > ...except, you're right, of course it does cause this issue. Thanks for catching this. > > I'll write a test for this and try to find a further change to the code > which retains the improvement in clarity while still fixing this issue. > > It should work to just arbitrarily take the capitalization from the > first completion in the list, I think, right? That also will make > things more consistent, I think? No, that's not correct, actually. I need to use try-completion to merge them to get nice behavior. So how about this? This mostly reverts my earlier patch, so it may be easier to review it relative to the old version before my earlier patch.