Fix minibuffer-next-completion in completing-read-multiple

* lisp/emacs-lisp/crm.el (completing-read-multiple):
Adapt to the previous removal of completion-base-affixes
(bug#48356, bug#48356).
This commit is contained in:
Dmitry Gutov 2025-02-11 17:47:21 +02:00
parent 737f249aa2
commit 88bc748f52

View file

@ -251,22 +251,16 @@ with empty strings removed."
(setq-local minibuffer-completion-table #'crm--collection-fn) (setq-local minibuffer-completion-table #'crm--collection-fn)
(setq-local minibuffer-completion-predicate predicate) (setq-local minibuffer-completion-predicate predicate)
(setq-local completion-list-insert-choice-function (setq-local completion-list-insert-choice-function
(lambda (start end choice) (lambda (_start _end choice)
(if (and (stringp start) (stringp end)) (let* ((beg (save-excursion
(let* ((beg (save-excursion (if (search-backward-regexp crm-separator nil t)
(goto-char (minibuffer-prompt-end)) (1+ (point))
(or (search-forward start nil t) (minibuffer-prompt-end))))
(search-forward-regexp crm-separator nil t) (end (save-excursion
(minibuffer-prompt-end)))) (if (search-forward-regexp crm-separator nil t)
(end (save-excursion (1- (point))
(goto-char (point-max)) (point-max)))))
(or (search-backward end nil t) (completion--replace beg end choice))))
(progn
(goto-char beg)
(search-forward-regexp crm-separator nil t))
(point-max)))))
(completion--replace beg end choice))
(completion--replace start end choice))))
;; see completing_read in src/minibuf.c ;; see completing_read in src/minibuf.c
(setq-local minibuffer-completion-confirm (setq-local minibuffer-completion-confirm
(unless (eq require-match t) require-match)) (unless (eq require-match t) require-match))