From: "Drew Adams" <drew.adams@oracle.com>
To: "'martin rudalics'" <rudalics@gmx.at>
Cc: 8851@debbugs.gnu.org
Subject: bug#8851: 24.0.50; regression: special-display-frame is no longer dedicated
Date: Mon, 13 Jun 2011 11:41:17 -0700 [thread overview]
Message-ID: <0C191F638279437BADFCC697A5389F9E@us.oracle.com> (raw)
In-Reply-To: <4DF65024.20305@gmx.at>
> Does the patch below fix it?
Thanks for your quick reply, Martin. No, I'm afraid it doesn't change anything
wrt this bug.
I didn't download the latest source files to apply your patch, but the build I'm
using is supposedly from today. I applied your patch manually to its source
code, which means that I eval'ed these two updated definitions (below). That
didn't help.
(defun display-buffer-in-window (buffer window specifiers)
"Display BUFFER in WINDOW and raise its frame if needed.
WINDOW must be a live window and defaults to the selected one.
Return WINDOW.
SPECIFIERS must be a list of buffer display specifiers, see the
documentation of `display-buffer-alist' for a description."
(setq buffer (normalize-live-buffer buffer))
(setq window (normalize-live-window window))
(let* ((old-frame (selected-frame))
(new-frame (window-frame window))
(dedicated (cdr (assq 'dedicated specifiers)))
(no-other-window (cdr (assq 'no-other-window specifiers))))
;; Show BUFFER in WINDOW.
;;---- (set-window-dedicated-p window nil)
(set-window-buffer window buffer)
(when dedicated
(set-window-dedicated-p window dedicated))
(when no-other-window
(set-window-parameter window 'no-other-window t))
(unless (eq old-frame new-frame)
(display-buffer-select-window window))
;; Return window.
window))
(defun display-buffer-reuse-window (buffer method &optional specifiers)
"Display BUFFER in an existing window.
METHOD must be a list in the form of the cdr of a `reuse-window'
buffer display specifier, see `display-buffer-alist' for an
explanation. The first element must specifiy the window to use,
and can be either nil, `same', `other', or a live window. The
second element must specify the window's buffer and can be either
nil, `same', `other', or a live buffer. The third element is the
frame to use - either nil, 0, `visible', `other', t, or a live
frame.
Optional argument SPECIFIERS must be a list of valid display
specifiers. Return the window chosen to display BUFFER, nil if
none was found."
(let* ((method-window (nth 0 method))
(method-buffer (nth 1 method))
(method-frame (nth 2 method))
(reuse-dedicated (assq 'reuse-window-dedicated specifiers))
windows other-frame dedicated time best-window best-time)
(when (eq method-frame 'other)
;; `other' is not handled by `window-list-1'.
(setq other-frame t)
(setq method-frame t))
(dolist (window (window-list-1 nil 'nomini method-frame))
(let ((window-buffer (window-buffer window)))
(when (and (not (window-minibuffer-p window))
;; Don't reuse a side window.
(or (not (eq (window-parameter window 'window-side) 'side))
(eq window-buffer buffer))
(or (not method-window)
(and (eq method-window 'same)
(eq window (selected-window)))
(and (eq method-window 'other)
(not (eq window (selected-window))))
;; Special case for applications that specifiy
;; the window explicitly.
(eq method-window window))
(or (not method-buffer)
(and (eq method-buffer 'same)
(eq window-buffer buffer))
(and (eq method-buffer 'other)
(not (eq window-buffer buffer)))
;; Special case for applications that specifiy
;; the window's buffer explicitly.
(eq method-buffer window-buffer))
(or (not other-frame)
(not (eq (window-frame window) (selected-frame))))
;; Handle dedicatedness.
(or (eq window-buffer buffer)
;; The window does not show the same buffer.
(not (setq dedicated (window-dedicated-p window)))
;; If the window is weakly dedicated to its
;; buffer, reuse-dedicated must be non-nil.
(and (not (eq dedicated t)) reuse-dedicated)
;; If the window is strongly dedicated to its
;; buffer, reuse-dedicated must be t.
(eq reuse-dedicated t)))
(setq windows (cons window windows)))))
(if (eq method-buffer 'same)
;; When reusing a window on the same buffer use the lru one.
(dolist (window windows)
(setq time (window-use-time window))
(when (or (not best-window) (< time best-time))
(setq best-window window)
(setq best-time time)))
;; Otherwise, sort windows according to their use-time.
(setq windows
(sort windows
#'(lambda (window-1 window-2)
(<= (window-use-time window-1)
(window-use-time window-2)))))
(setq best-window
;; Try to get a full-width window (this is silly and can
;; get us to another frame but let's ignore these issues
;; for the moment).
(catch 'found
(dolist (window windows)
(when (window-full-width-p window)
(throw 'found window)))
;; If there's no full-width window return the lru window.
(car windows))))
(when best-window
(display-buffer-even-window-sizes best-window specifiers)
;; Never change the quit-restore parameter of a window here.
(if (eq (window-buffer best-window) buffer)
(setq display-buffer-window
(cons best-window 'reuse-buffer-window))
(setq display-buffer-window
(cons best-window 'reuse-other-window))
(unless (window-parameter best-window 'quit-restore)
;; Don't overwrite an existing quit-restore entry.
(set-window-parameter
best-window 'quit-restore
(list (window-buffer best-window) (window-start best-window)
(window-point best-window) buffer
(window-total-size best-window) (selected-window)))))
;; Reset dedicated status of best-window here.
(set-window-dedicated-p best-window nil)
(display-buffer-in-window buffer best-window specifiers))))
next prev parent reply other threads:[~2011-06-13 18:41 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-13 16:08 bug#8851: 24.0.50; regression: special-display-frame is no longer dedicated Drew Adams
2011-06-13 18:00 ` martin rudalics
2011-06-13 18:41 ` Drew Adams [this message]
2011-06-14 9:15 ` martin rudalics
2011-06-14 20:36 ` Drew Adams
[not found] ` <4DFB6BBF.3080504@gmx.at>
2011-06-17 15:51 ` Drew Adams
2011-06-17 16:22 ` bug#8856: " martin rudalics
2011-06-17 17:48 ` Drew Adams
2011-06-19 17:29 ` Drew Adams
2011-06-20 3:04 ` Stefan Monnier
2011-06-17 17:48 ` bug#8856: " Drew Adams
2011-06-19 13:26 ` martin rudalics
2011-06-19 14:31 ` bug#8856: 24.0.50;regression: `special-display-frame' broken Drew Adams
2011-06-19 18:50 ` Chong Yidong
2011-06-19 18:54 ` Drew Adams
[not found] ` <4DFE09A7.10500@gmx.at>
2011-06-19 14:43 ` bug#8856: 24.0.50; regression: special-display-frame is no longer dedicated Drew Adams
2011-06-19 17:26 ` Drew Adams
2011-06-19 18:40 ` martin rudalics
2011-06-19 19:34 ` bug#8856: 24.0.50; regression: `special-display-popup-frame' broken Drew Adams
2011-06-19 19:52 ` Drew Adams
2011-06-20 9:46 ` bug#8856: 24.0.50; regression: special-display-frame is no longer dedicated martin rudalics
2011-06-20 13:01 ` Drew Adams
[not found] ` <4E00C54C.5080108@gmx.at>
2011-06-21 18:10 ` Drew Adams
2011-06-22 0:13 ` Drew Adams
2011-06-22 0:14 ` Drew Adams
2011-06-22 0:15 ` Drew Adams
2011-06-23 16:45 ` Drew Adams
[not found] ` <4E033CBA.1050700@gmx.at>
[not found] ` <DB9EDF1C454F42A0BC437F0E0AEE6CA2@us.oracle.com>
[not found] ` <4E037708.2000205@gmx.at>
2011-06-23 22:06 ` Drew Adams
2011-06-24 8:53 ` martin rudalics
2011-06-24 21:21 ` Drew Adams
2011-06-25 14:15 ` martin rudalics
2011-06-25 14:52 ` Drew Adams
[not found] ` <8A3D5626004B4 945A624B69463A0B849@us.oracle.com>
2011-06-25 15:04 ` Drew Adams
2011-06-25 15:57 ` martin rudalics
2011-06-25 16:15 ` Drew Adams
2011-06-25 17:00 ` martin rudalics
2011-06-25 17:48 ` Drew Adams
2011-06-26 13:50 ` martin rudalics
2011-06-26 14:56 ` Drew Adams
[not found] ` <0721F495F4A441529FCB91280D284E42@us.oracle.com! >
2011-06-26 15:15 ` Drew Adams
2011-06-26 15:54 ` martin rudalics
2011-06-26 16:06 ` Drew Adams
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=0C191F638279437BADFCC697A5389F9E@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=8851@debbugs.gnu.org \
--cc=rudalics@gmx.at \
/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).