From: joaotavora@gmail.com (João Távora)
To: 22997@debbugs.gnu.org
Subject: bug#22997: 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 [thread overview]
Message-ID: <m18u1ny7v1.fsf@holy.lan> (raw)
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ão
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-alist)
minor-mode-overriding-map-alist))
+ (setq display-buffer-alist
+ (delq (assq 'completion--in-region-mode-display-guard-p display-buffer-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)))
;; 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))
+;; 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 (_buffer _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 should
next reply other threads:[~2016-03-12 16:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-12 16:32 João Távora [this message]
2020-12-02 12:37 ` bug#22997: 25.0.50; reusing windows in pop-to-buffer while in completion-in-region-mode opens new frames Lars Ingebrigtsen
2020-12-02 12:44 ` João Távora
2020-12-03 8:42 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m18u1ny7v1.fsf@holy.lan \
--to=joaotavora@gmail.com \
--cc=22997@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.