* bug#22997: 25.0.50; reusing windows in pop-to-buffer while in completion-in-region-mode opens new frames
@ 2016-03-12 16:32 João Távora
2020-12-02 12:37 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: João Távora @ 2016-03-12 16:32 UTC (permalink / raw)
To: 22997
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#22997: 25.0.50; reusing windows in pop-to-buffer while in completion-in-region-mode opens new frames
2016-03-12 16:32 bug#22997: 25.0.50; reusing windows in pop-to-buffer while in completion-in-region-mode opens new frames João Távora
@ 2020-12-02 12:37 ` Lars Ingebrigtsen
2020-12-02 12:44 ` João Távora
0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-02 12:37 UTC (permalink / raw)
To: João Távora; +Cc: 22997
joaotavora@gmail.com (João Távora) writes:
> 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.
I'm unable to reproduce this problem in Emacs 28, but I'm not sure I
understand the recipe -- surely Emacs doesn't pop up a new frame on
pop-to-buffer without further customisation? So is there something
missing in the recipe, or has the bug just gone away over the years?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#22997: 25.0.50; reusing windows in pop-to-buffer while in completion-in-region-mode opens new frames
2020-12-02 12:37 ` Lars Ingebrigtsen
@ 2020-12-02 12:44 ` João Távora
2020-12-03 8:42 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: João Távora @ 2020-12-02 12:44 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 22997
On Wed, Dec 2, 2020 at 12:37 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
Hi Lars,
> surely Emacs doesn't pop up a new frame on
> pop-to-buffer without further customisation?
When pop-to-buffer finds itself in a tight spot (no space on current frame),
I think it will/would in certain situations pop a new frame.
> So is there something
> missing in the recipe, or has the bug just gone away over the years?
I have a vague recollection that the recipe was accurate, and eventually
something in window.el was fixed, by me or Martin or both. Likely I
forgot to x-ref the bug id. If you can't reproduce it, I think you should
just close this bug.
Hey, I found commit 5d34e1b2881caa5743816030c2e9cdcda58e9719
that looks relevant.
João
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#22997: 25.0.50; reusing windows in pop-to-buffer while in completion-in-region-mode opens new frames
2020-12-02 12:44 ` João Távora
@ 2020-12-03 8:42 ` Lars Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-03 8:42 UTC (permalink / raw)
To: João Távora; +Cc: 22997
João Távora <joaotavora@gmail.com> writes:
>> So is there something
>> missing in the recipe, or has the bug just gone away over the years?
>
> I have a vague recollection that the recipe was accurate, and eventually
> something in window.el was fixed, by me or Martin or both. Likely I
> forgot to x-ref the bug id. If you can't reproduce it, I think you should
> just close this bug.
OK, closing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-03 8:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-12 16:32 bug#22997: 25.0.50; reusing windows in pop-to-buffer while in completion-in-region-mode opens new frames João Távora
2020-12-02 12:37 ` Lars Ingebrigtsen
2020-12-02 12:44 ` João Távora
2020-12-03 8:42 ` Lars Ingebrigtsen
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).