From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45474: Icomplete exhibiting in recursive minibuffer when it =?UTF-8?Q?shouldn=E2=80=99t?= Date: Mon, 19 Apr 2021 21:16:18 +0300 Organization: LINKOV.NET Message-ID: <871rb6np5j.fsf@mail.linkov.net> References: <3ed97a9c53e0a5d4fef8@heytings.org> <87fszrz21d.fsf@mail.linkov.net> <3ed97a9c530093aca93d@heytings.org> <7dee3f4235d331cab291@heytings.org> <87r1jatd34.fsf@mail.linkov.net> <7dee3f423551aaf318cb@heytings.org> <87im4kzlfm.fsf@mail.linkov.net> <1869622e16546eafd9df@heytings.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38754"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Gregory Heytings , Dario Gjorgjevski , 45474@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 19 20:25:26 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYYaL-0009xf-LO for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Apr 2021 20:25:25 +0200 Original-Received: from localhost ([::1]:55282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYYaK-0006fg-O5 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Apr 2021 14:25:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYYY2-00064P-MZ for bug-gnu-emacs@gnu.org; Mon, 19 Apr 2021 14:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40495) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYYY2-0003Jt-F9 for bug-gnu-emacs@gnu.org; Mon, 19 Apr 2021 14:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYYY2-0007ya-C7 for bug-gnu-emacs@gnu.org; Mon, 19 Apr 2021 14:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Apr 2021 18:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45474 X-GNU-PR-Package: emacs Original-Received: via spool by 45474-submit@debbugs.gnu.org id=B45474.161885655430601 (code B ref 45474); Mon, 19 Apr 2021 18:23:02 +0000 Original-Received: (at 45474) by debbugs.gnu.org; 19 Apr 2021 18:22:34 +0000 Original-Received: from localhost ([127.0.0.1]:52038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYYXZ-0007xU-LB for submit@debbugs.gnu.org; Mon, 19 Apr 2021 14:22:34 -0400 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:56037) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYYXX-0007wv-Si for 45474@debbugs.gnu.org; Mon, 19 Apr 2021 14:22:32 -0400 X-Originating-IP: 91.129.102.166 Original-Received: from mail.gandi.net (m91-129-102-166.cust.tele2.ee [91.129.102.166]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id C2DDFC000A; Mon, 19 Apr 2021 18:22:23 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Sat, 17 Apr 2021 17:58:31 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:204496 Archived-At: --=-=-= Content-Type: text/plain > 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'? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=completing-minibuffer.patch 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))) ;; Miscellaneous --=-=-=--