1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix completion error in C-x RET f ut-8-d TAB

The core of the problem is that `completion-pcm--prepare-delim-re`
is designed to match a "delimiter" in the pattern but was misused
to match a sequence of delimiter chars in the completions.

* lisp/minibuffer.el (completion-pcm--delim-re): Rename from
`completion-pcm--prepare-delim-re` and change its calling convention.
(completion-pcm--segments->regex): Use it.
(completion-pcm-word-delimiters): Adjust accordingly.

* test/lisp/minibuffer-tests.el (completion-pcm--test-zerowidth-delim):
New test.
This commit is contained in:
Stefan Monnier 2025-11-26 09:53:19 -05:00
parent 4e7e340ee5
commit e10c4982dc
2 changed files with 16 additions and 4 deletions

View file

@ -4188,8 +4188,8 @@ a submatch 1, then completion can add something at (match-end 1).
This is used when the delimiter needs to be of size zero (e.g. the transition
from lowercase to uppercase characters).")
(defun completion-pcm--prepare-delim-re (delims)
(setq completion-pcm--delim-wild-regex (concat "[" delims "*]")))
(defun completion-pcm--delim-re (delims)
(concat "[" delims "*]"))
(defcustom completion-pcm-word-delimiters "-_./:| "
"A string of characters treated as word delimiters for completion.
@ -4202,7 +4202,8 @@ expression (not containing character ranges like `a-z')."
:set (lambda (symbol value)
(set-default symbol value)
;; Refresh other vars.
(completion-pcm--prepare-delim-re value))
(setq completion-pcm--delim-wild-regex
(completion-pcm--delim-re value)))
:initialize 'custom-initialize-reset
:type 'string)
@ -4342,7 +4343,9 @@ one wildcard."
(concat
(when group "\\(")
(if (all (lambda (x) (eq x 'any-delim)) (cdr segment))
(concat completion-pcm--delim-wild-regex "*?")
(concat (completion-pcm--delim-re
completion-pcm-word-delimiters)
"*?")
"[^z-a]*?")
(when group "\\)")))))
segments