]> git.eshelyaron.com Git - emacs.git/commitdiff
minibuffer-completion-help: Fix earlier mistake
authorDmitry Gutov <dmitry@gutov.dev>
Sat, 18 May 2024 13:30:23 +0000 (16:30 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sat, 18 May 2024 18:58:01 +0000 (20:58 +0200)
* lisp/minibuffer.el (minibuffer-completion-help): Fix earlier
mistake.  Instead of altering a variable whose value is
immutable (and already captured in a saved list), move the
reference to said list to a lexical binding and alter that
list's second element instead.

https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg00875.html
(cherry picked from commit 6badb1260a5e5107887d244507a7289fa1a30a91)

lisp/minibuffer.el

index de690d83804fcc8d9f232173edcc593adb32b4a7..d9ce8c89065cfffa1b4598575482f73ba1cbc20b 100644 (file)
@@ -2999,6 +2999,7 @@ completions list."
                                              (buffer-substring (point) end))))
                 (point)))
              (field-char (and (< field-end end) (char-after field-end)))
+             (base-position (list (+ start base-size) field-end))
              (style completion--matching-style)
              (exceptional-candidates
               (or (not completions-exclude-exceptional-candidates)
@@ -3119,7 +3120,7 @@ completions list."
                  :predicate cpred
                  :exceptional-candidates exceptional-candidates
                  :action action
-                 :base-position (list (+ start base-size) field-end)
+                 :base-position base-position
                  :base-prefix base-prefix
                  :ignore-case completion-ignore-case
                  :insert-choice-function
@@ -3145,9 +3146,9 @@ completions list."
                                 (= (aref choice (1- (length choice)))
                                    field-char))
                        (setq end (1+ end)))
-                     (cl-decf field-end (- end start (length choice)))
+                     (cl-decf (nth 1 base-position) (- end start (length choice)))
                      ;; FIXME: Use `md' to do quoting&terminator here.
-                     (completion--replace start end choice)
+                     (completion--replace start (min end (point-max)) choice)
                      (let* ((minibuffer-completion-table ctable)
                             (minibuffer-completion-predicate cpred)
                             (completion-extra-properties cprops)