GNU bug report logs - #22997
25.0.50; reusing windows in pop-to-buffer while in completion-in-region-mode opens new frames

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: joaotavora@HIDDEN (João Távora); dated Sat, 12 Mar 2016 16:34:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Mar 2016 16:33:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 12 11:33:08 2016
Received: from localhost ([127.0.0.1]:46427 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aemTT-0003g9-OB
	for submit <at> debbugs.gnu.org; Sat, 12 Mar 2016 11:33:07 -0500
Received: from eggs.gnu.org ([208.118.235.92]:34123)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <joaotavora@HIDDEN>) id 1aemTS-0003fh-78
 for submit <at> debbugs.gnu.org; Sat, 12 Mar 2016 11:33:06 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <joaotavora@HIDDEN>) id 1aemTL-00071L-Tn
 for submit <at> debbugs.gnu.org; Sat, 12 Mar 2016 11:33:00 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:52311)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <joaotavora@HIDDEN>) id 1aemTL-00071H-QO
 for submit <at> debbugs.gnu.org; Sat, 12 Mar 2016 11:32:59 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53321)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <joaotavora@HIDDEN>) id 1aemTK-0002OH-PZ
 for bug-gnu-emacs@HIDDEN; Sat, 12 Mar 2016 11:32:59 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <joaotavora@HIDDEN>) id 1aemTH-000711-JQ
 for bug-gnu-emacs@HIDDEN; Sat, 12 Mar 2016 11:32:58 -0500
Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:36037)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <joaotavora@HIDDEN>) id 1aemTH-00070s-87
 for bug-gnu-emacs@HIDDEN; Sat, 12 Mar 2016 11:32:55 -0500
Received: by mail-wm0-x22c.google.com with SMTP id n186so55690527wmn.1
 for <bug-gnu-emacs@HIDDEN>; Sat, 12 Mar 2016 08:32:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:subject:date:message-id:user-agent:mime-version
 :content-transfer-encoding;
 bh=Ysi9VX3/7jkeC/vRROT6hv/0WHrQLnGMU92b0ljbpr4=;
 b=a6XhwNgWesEeZBYc+9+HeCKUyjyyvpkjRQXYWODnEfcT+iN52DlNz9npAXivjn05Ul
 DfcaQWAoJbBb++GCoQ3ShHyIvWsrRM03jH98fUHkm5iO56QcKGAOYGTJTXqdHp0NcBrP
 sB4bR5SdS3mcIxg/howtfGn4O2KzH7lUydN1pp/A7PsHLP3ywQwl9JnOwJ2MC31KujG8
 sFvyjAx1PI/TakkOL9PKW+8YsE0cVKoR5nmEPB4c7C7O/0Sw5Ix68AWgc8izRkiaYpSZ
 XQ5ih2JEMphXsMcm5QdI+INkFgu6yIIPv2jvhdl9BsBXfyA8C0H0vLN7mwRn1DRBYMAS
 DP+g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:subject:date:message-id:user-agent
 :mime-version:content-transfer-encoding;
 bh=Ysi9VX3/7jkeC/vRROT6hv/0WHrQLnGMU92b0ljbpr4=;
 b=QZuw/EsWChDXwUI3oPUfRSmmow6G2X02r3EFZ5dlO8ZT50NzaI85tsRtwWy2qpfJzk
 OT+RMyc9oj9+4EWX94c6ZkQ/+zUZ2mYmiq9Bm+smmqBR7qFrJkdzkwJZHOGFXel83bf5
 +ATQdxAkN5zRrKZiZUZZmAbkaXYJMqawvqY5/1+3xAAV5X4xIEfyhohifuP7bDq6ZTEY
 SJ2BVvjWyco9tObpwQwTWrv37gSaHevH12LxErVF+PlxH7flkjK/TPc6vWEwhFDoX4vT
 jlLTbFBqD63H9meOAyNGlxy5zJwNK9w/0QnBCIfKtLyG77P9iC13K/InUqNBIBUWckGk
 GqbQ==
X-Gm-Message-State: AD7BkJIYyNDo5HAYbKw9HZ0t1KQ7GzszX2/VJdMlFTD4t8x0559QFIllNGHefJunb7K9rg==
X-Received: by 10.28.107.9 with SMTP id g9mr9104287wmc.34.1457800374172;
 Sat, 12 Mar 2016 08:32:54 -0800 (PST)
Received: from holy.lan.yourcompany.com (31.57.37.188.rev.vodafone.pt.
 [188.37.57.31])
 by smtp.gmail.com with ESMTPSA id ei9sm13856273wjd.40.2016.03.12.08.32.53
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 12 Mar 2016 08:32:53 -0800 (PST)
From: joaotavora@HIDDEN (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=)
To: bug-gnu-emacs@HIDDEN
Subject: 25.0.50;
 reusing windows in pop-to-buffer while in completion-in-region-mode
 opens new frames
Date: Sat, 12 Mar 2016 16:32:50 +0000
Message-ID: <m18u1ny7v1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

Hi maintainers,

Emacs -Q and use just this customization

  (setq display-buffer-base-action
        `(display-buffer-reuse-window . ((inhibit-same-window . t))))

Do something that enters completion-in-region-mode. While in that
transient mode, invoke something that pops a buffer.

  d i s p l a  M-x complete-symbol RET
  M-x pop-to-buffer RET *Messages* RET

A new frame is created even though pop-up-frames is nil. I believe the
reason is that the *Completions* window is "soft-dedicated" in
minibuffer.el.

My fix would be to exit the transient completion-in-region-mode before
displaying other buffers. This can be done by setting
display-buffer-alist appropriately in completion-in-region-mode, much
like it sets and resets minor-mode-overriding-map-alist.

I've tried this in an extension of mine, SLY, with a mode very similar
to completion-in-region-mode, but the same technique doesn't work there
for some reason.

Anyway, the _failed_ patch after my signature.
Jo=C3=A3o

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 2814d02..c115476 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2024,6 +2024,9 @@ completion-in-region-mode
   (setq minor-mode-overriding-map-alist
         (delq (assq 'completion-in-region-mode minor-mode-overriding-map-a=
list)
               minor-mode-overriding-map-alist))
+  (setq display-buffer-alist
+        (delq (assq 'completion--in-region-mode-display-guard-p display-bu=
ffer-alist)
+              display-buffer-alist))
   (if (null completion-in-region-mode)
       (progn
         (setq completion-in-region--data nil)
@@ -2035,7 +2038,11 @@ completion-in-region-mode
 	  completion-in-region-mode-predicate)
     (add-hook 'post-command-hook #'completion-in-region--postch)
     (push `(completion-in-region-mode . ,completion-in-region-mode-map)
-          minor-mode-overriding-map-alist)))
+          minor-mode-overriding-map-alist)
+    (push `(completion--in-region-mode-display-guard-p
+            (completion--in-region-mode-teardown-before-displaying-others
+             . ,display-buffer-alist))
+          display-buffer-alist)))
=20
 ;; Define-minor-mode added our keymap to minor-mode-map-alist, but we want=
 it
 ;; on minor-mode-overriding-map-alist instead.
@@ -2043,6 +2050,17 @@ completion-in-region-mode
       (delq (assq 'completion-in-region-mode minor-mode-map-alist)
             minor-mode-map-alist))
=20
+;; Do some crazy `display-buffer-alist' antics to prevent the
+;; soft-dedication of *Completions* to interfere with normal
+;; display-buffer
+(defun completion--in-region-mode-display-guard-p (buffer-name _alist)
+  (not (equal "*Completions*" buffer-name)))
+
+(defun completion--in-region-mode-teardown-before-displaying-others (_buff=
er _action)
+  (completion-in-region-mode -1)
+  ;; explicitly return nil, for clarity
+  nil)
+
 (defvar completion-at-point-functions '(tags-completion-at-point-function)
   "Special hook to find the completion table for the thing at point.
 Each function on this hook is called in turn without any argument and shou=
ld




Acknowledgement sent to joaotavora@HIDDEN (João Távora):
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#22997; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.