Fix minibuffer-next-completion in completing-read-multiple
authorDmitry Gutov <dmitry@gutov.dev>
Tue, 11 Feb 2025 15:47:21 +0000 (17:47 +0200)
committerDmitry Gutov <dmitry@gutov.dev>
Tue, 11 Feb 2025 15:47:21 +0000 (17:47 +0200)
* lisp/emacs-lisp/crm.el (completing-read-multiple):
Adapt to the previous removal of completion-base-affixes
(bug#48356, bug#48356).

lisp/emacs-lisp/crm.el

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