summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-05-01 15:30:57 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2021-05-01 15:30:57 -0400
commit0ce2f591ff9acd8cfb0944d0de95723e7db0d6f0 (patch)
tree68e39f8875d8ba88e806e78e21cc7ab70510d539 /lisp/minibuffer.el
parent6b2d017ead856c244a0b5c5a162254094877bc54 (diff)
downloademacs-0ce2f591ff9acd8cfb0944d0de95723e7db0d6f0.tar.gz
* lisp/minibuffer.el (completing-read-default): Fix bug#45474
Set `minibuffer-completion-*` variables buffer-locally instead of using a global let-binding. This should also help make completion work correctly when multiple minibuffers are simultaneously active.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 24006249530..caf06ec7104 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3900,13 +3900,7 @@ See `completing-read' for the meaning of the arguments."
;; `read-from-minibuffer' uses 1-based index.
(1+ (cdr initial-input)))))
- (let* ((minibuffer-completion-table collection)
- (minibuffer-completion-predicate predicate)
- ;; FIXME: Remove/rename this var, see the next one.
- (minibuffer-completion-confirm (unless (eq require-match t)
- require-match))
- (minibuffer--require-match require-match)
- (base-keymap (if require-match
+ (let* ((base-keymap (if require-match
minibuffer-local-must-match-map
minibuffer-local-completion-map))
(keymap (if (memq minibuffer-completing-file-name '(nil lambda))
@@ -3919,8 +3913,17 @@ See `completing-read' for the meaning of the arguments."
;; in minibuffer-local-filename-completion-map can
;; override bindings in base-keymap.
base-keymap)))
- (result (read-from-minibuffer prompt initial-input keymap
- nil hist def inherit-input-method)))
+ (result
+ (minibuffer-with-setup-hook
+ (lambda ()
+ (setq-local minibuffer-completion-table collection)
+ (setq-local minibuffer-completion-predicate predicate)
+ ;; FIXME: Remove/rename this var, see the next one.
+ (setq-local minibuffer-completion-confirm
+ (unless (eq require-match t) require-match))
+ (setq-local minibuffer--require-match require-match))
+ (read-from-minibuffer prompt initial-input keymap
+ nil hist def inherit-input-method))))
(when (and (equal result "") def)
(setq result (if (consp def) (car def) def)))
result))