[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’
From: |
Stefan Monnier |
Subject: |
bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t |
Date: |
Thu, 22 Apr 2021 10:13:22 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> I tested your patch and discovered that it fails when two nested
>> minibuffers both use completion, e.g. C-x C-f C-h v raises the error:
>>
>> Error in post-command-hook (icomplete-post-command-hook):
>> (wrong-type-argument symbolp
>
> Indeed, it's nasty:
>
> - In the first step, we
> - let-bind (globally) m-c-table to read-file-name-internal
> - go to minibuf-1
> - make it buffer-local in minibuf-1
> - everything's dandy
> - In the second step, things get ugly
> - we're in minibuf-1
> - we let-bind m-c-table to help--symbol-completion-table which
> only works buffer-locally in minibuf-1 (thus temporarily overriding
> the value set just before).
> - we go to minibuf-2 which still has no buffer-local setting so it
> sees the global value that's still read-file-name-internal (because
> of the very first part of the first step)
> - we make it buffer-local but to this wrong value
>
> So in the end we get a wrong m-c-table in both buffers (the values are
> reversed!).
I'm more and more thinking that we should really bite the bullet and go
for a "really buffer-local" setup, such as in the patch below.
I'd be surprised if it doesn't introduce backward incompatibilities, but
at least it's "The Right Thing" to do.
Stefan
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 7da3c39e6b9..ce136b90449 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3884,13 +3884,7 @@ completing-read-default
;; `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))
@@ -3903,8 +3897,17 @@ completing-read-default
;; 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))
- bug#45474: [External] : bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, (continued)
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Juri Linkov, 2021/04/19
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Stefan Monnier, 2021/04/19
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Gregory Heytings, 2021/04/20
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Stefan Monnier, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Gregory Heytings, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Juri Linkov, 2021/04/20
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Stefan Monnier, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t,
Stefan Monnier <=
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Gregory Heytings, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Gregory Heytings, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Stefan Monnier, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Gregory Heytings, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Gregory Heytings, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Gregory Heytings, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Stefan Monnier, 2021/04/22
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Eli Zaretskii, 2021/04/23
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Stefan Monnier, 2021/04/23
- bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t, Eli Zaretskii, 2021/04/23