From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Gregory Heytings <gregory@heytings.org>,
Dario Gjorgjevski <dario.gjorgjevski@gmail.com>,
45474@debbugs.gnu.org
Subject: bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t
Date: Mon, 19 Apr 2021 21:16:18 +0300 [thread overview]
Message-ID: <871rb6np5j.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvk0p04mbj.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 17 Apr 2021 17:58:31 -0400")
[-- Attachment #1: Type: text/plain, Size: 874 bytes --]
> A quick&dirty workaround for now would be for `completing-read` to set
> some var alongside `minibuffer-completion-table` which indicates *which*
> minibuffer this is for (e.g. some minibuffer-depth information).
> This way `read-from-minibuffer` could distinguish
> a `minibuffer-completion-table` passed for the current invocation from
> one passed for the outer invocation and could hence temporarily rebind
> `minibuffer-completion-table` to nil.
This patch is how I thought your suggestion could be implemented,
but then later you posted a different patch. Anyway FWIW here is
a safer workable workaround that implements your first suggestion
and sets a new explicit buffer-local variable in completing minibuffers,
so modes that need to distinguish such minibuffers could check it.
Maybe this minibuffer-with-setup-hook could be moved even to
'completing-read'?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: completing-minibuffer.patch --]
[-- Type: text/x-diff, Size: 1820 bytes --]
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 91bbb60013..543e451c5d 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -400,7 +400,7 @@ icomplete-mode
(add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)))
(defun icomplete--completion-table ()
- (if (window-minibuffer-p) minibuffer-completion-table
+ (if (window-minibuffer-p) (and completing-minibuffer minibuffer-completion-table)
(or (nth 2 completion-in-region--data)
(message "In %S (w=%S): %S"
(current-buffer) (selected-window) (window-minibuffer-p)))))
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a0247d1fba..3ceb67733d 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3826,6 +3826,8 @@ completing-read-function
"The function called by `completing-read' to do its work.
It should accept the same arguments as `completing-read'.")
+(defvar completing-minibuffer nil)
+
(defun completing-read-default (prompt collection &optional predicate
require-match initial-input
hist def inherit-input-method)
@@ -3839,6 +3841,9 @@ completing-read-default
;; `read-from-minibuffer' uses 1-based index.
(1+ (cdr initial-input)))))
+ (minibuffer-with-setup-hook
+ (lambda ()
+ (setq-local completing-minibuffer t))
(let* ((minibuffer-completion-table collection)
(minibuffer-completion-predicate predicate)
;; FIXME: Remove/rename this var, see the next one.
@@ -3862,7 +3867,7 @@ completing-read-default
nil hist def inherit-input-method)))
(when (and (equal result "") def)
(setq result (if (consp def) (car def) def)))
- result))
+ result)))
\f
;; Miscellaneous
next prev parent reply other threads:[~2021-04-19 18:16 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-27 17:44 bug#45474: Icomplete exhibiting in recursive minibuffer when it shouldn’t Dario Gjorgjevski
2021-04-15 17:40 ` Gregory Heytings
2021-04-15 21:11 ` Juri Linkov
2021-04-15 22:34 ` Gregory Heytings
2021-04-16 0:03 ` Gregory Heytings
2021-04-16 16:34 ` Juri Linkov
2021-04-16 16:55 ` Gregory Heytings
2021-04-17 20:49 ` Juri Linkov
2021-04-17 21:35 ` Gregory Heytings
2021-04-17 21:58 ` Stefan Monnier
2021-04-17 22:16 ` Gregory Heytings
2021-04-18 14:44 ` Stefan Monnier
2021-04-18 22:23 ` Gregory Heytings
2021-04-19 1:26 ` Stefan Monnier
2021-04-19 12:14 ` Gregory Heytings
2021-04-19 15:57 ` Stefan Monnier
2021-04-19 20:20 ` Gregory Heytings
2021-04-17 23:21 ` bug#45474: [External] : " Drew Adams
2021-04-18 3:59 ` Stefan Monnier
2021-04-18 4:04 ` Drew Adams
2021-04-18 5:08 ` Stefan Monnier
2021-04-18 15:42 ` Drew Adams
2021-04-18 18:35 ` Stefan Monnier
2021-04-18 20:11 ` Drew Adams
2021-04-18 20:53 ` Stefan Monnier
2021-04-18 23:46 ` Drew Adams
2021-04-22 15:03 ` Stefan Monnier
2021-04-19 18:16 ` Juri Linkov [this message]
2021-04-19 21:42 ` Stefan Monnier
2021-04-20 19:00 ` Gregory Heytings
2021-04-22 13:56 ` Stefan Monnier
2021-04-22 14:08 ` Gregory Heytings
2021-04-20 19:01 ` Juri Linkov
2021-04-22 13:54 ` Stefan Monnier
2021-04-22 14:13 ` Stefan Monnier
2021-04-22 14:18 ` Gregory Heytings
2021-04-22 15:18 ` Gregory Heytings
2021-04-22 18:36 ` Stefan Monnier
2021-04-22 19:04 ` Gregory Heytings
2021-04-22 19:59 ` Gregory Heytings
2021-04-22 20:57 ` Gregory Heytings
2021-04-22 23:24 ` Stefan Monnier
2021-04-23 6:06 ` Eli Zaretskii
2021-04-23 13:12 ` Stefan Monnier
2021-04-23 13:19 ` Eli Zaretskii
2021-04-23 15:18 ` Stefan Monnier
2021-04-23 17:37 ` Eli Zaretskii
2021-04-23 6:59 ` Gregory Heytings
2021-04-23 13:21 ` Stefan Monnier
2021-04-23 13:45 ` Gregory Heytings
2021-04-23 15:35 ` Stefan Monnier
2021-04-23 15:58 ` Gregory Heytings
2021-04-23 16:36 ` Juri Linkov
2021-04-23 16:55 ` Stefan Monnier
2021-04-23 18:13 ` Gregory Heytings
2021-04-23 20:24 ` Stefan Monnier
2021-04-23 21:36 ` Gregory Heytings
2021-04-23 21:54 ` Stefan Monnier
2021-04-24 8:44 ` Gregory Heytings
2021-05-01 19:34 ` Stefan Monnier
2021-05-03 8:40 ` Gregory Heytings
2022-06-07 12:04 ` Lars Ingebrigtsen
2021-04-22 21:57 ` Juri Linkov
2021-04-23 15:53 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871rb6np5j.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=45474@debbugs.gnu.org \
--cc=dario.gjorgjevski@gmail.com \
--cc=gregory@heytings.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).