unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1415: 23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument
@ 2008-11-22 17:01 ` Helmut Eller
  2008-11-24  9:59   ` martin rudalics
  2008-11-27 13:55   ` bug#1415: marked as done (23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument) Emacs bug Tracking System
  0 siblings, 2 replies; 4+ messages in thread
From: Helmut Eller @ 2008-11-22 17:01 UTC (permalink / raw)
  To: emacs-pretest-bug


I think that display-buffer returns sometimes the selected window even
if the NOT-THIS-WINDOW argument is true.  Here is a test case:

(progn
  (defun display-buffer-checked (buffer)
    (let ((selected (selected-window))
          (window (display-buffer buffer t)))
      (when (eq selected window)
        (error "display-buffer returned selected window"))
      window))
  
  (let ((foo (get-buffer-create "foo"))
        (bar (get-buffer-create "bar")))
    (select-window (get-buffer-window "*scratch*"))
    (save-selected-window 
      (select-window (display-buffer-checked foo)))
    (save-selected-window 
      (select-window (display-buffer-checked bar)))))


display-buffer-checked just calls display-buffer and checks that the
returned window isn't the selected window.  From looking at the code of
display-buffer, I would say that display-buffer returns the lru window
even if that's the selected window.

Helmut.


In GNU Emacs 23.0.60.10 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2008-11-22 on xaital
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--without-sound' '--without-pop' '--without-gif' '--without-tiff''






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#1415: 23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument
  2008-11-22 17:01 ` bug#1415: 23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument Helmut Eller
@ 2008-11-24  9:59   ` martin rudalics
  2008-11-26 21:13     ` Helmut Eller
  2008-11-27 13:55   ` bug#1415: marked as done (23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument) Emacs bug Tracking System
  1 sibling, 1 reply; 4+ messages in thread
From: martin rudalics @ 2008-11-24  9:59 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 1415

[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]

 > I think that display-buffer returns sometimes the selected window even
 > if the NOT-THIS-WINDOW argument is true.  Here is a test case:
 >
 > (progn
 >   (defun display-buffer-checked (buffer)
 >     (let ((selected (selected-window))
 >           (window (display-buffer buffer t)))
 >       (when (eq selected window)
 >         (error "display-buffer returned selected window"))
 >       window))
 >
 >   (let ((foo (get-buffer-create "foo"))
 >         (bar (get-buffer-create "bar")))
 >     (select-window (get-buffer-window "*scratch*"))
 >     (save-selected-window
 >       (select-window (display-buffer-checked foo)))
 >     (save-selected-window
 >       (select-window (display-buffer-checked bar)))))
 >
 >
 > display-buffer-checked just calls display-buffer and checks that the
 > returned window isn't the selected window.  From looking at the code of
 > display-buffer, I would say that display-buffer returns the lru window
 > even if that's the selected window.

Nice bug.  Thanks for the precise report and test case!

Emacs 22 handled this, but I'm too lazy to figure out how.

Please try the attached patch.

martin

[-- Attachment #2: window.diff --]
[-- Type: text/plain, Size: 1870 bytes --]

*** window.el.~1.168.~	2008-11-18 22:26:34.390625000 +0100
--- window.el	2008-11-24 10:31:29.953125000 +0100
***************
*** 1038,1051 ****
  		     (window--try-to-split-window
  		      (get-lru-window frame-to-use t))))
  	   (window--display-buffer-2 buffer window-to-use)))
!      ((setq window-to-use
! 	    ;; Reuse an existing window.
! 	    (or (get-lru-window frame-to-use)
! 		(get-buffer-window buffer 'visible)
! 		(get-largest-window 'visible nil)
! 		(get-buffer-window buffer 0)
! 		(get-largest-window 0 nil)
! 		(frame-selected-window (funcall pop-up-frame-function))))
        (window--even-window-heights window-to-use)
        (window--display-buffer-2 buffer window-to-use)))))
  
--- 1038,1063 ----
  		     (window--try-to-split-window
  		      (get-lru-window frame-to-use t))))
  	   (window--display-buffer-2 buffer window-to-use)))
!      ((let ((window-to-undedicate
! 	     ;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate
! 	     ;; the selected window to its buffer, to avoid that some of
! 	     ;; the routines below choose it.  (Bug#1415)
! 	     (and not-this-window
! 		  (not (window-dedicated-p (selected-window)))
! 		  (set-window-dedicated-p (selected-window) t)
! 		  (selected-window))))
! 	(unwind-protect
! 	    (setq window-to-use
! 		  ;; Reuse an existing window.
! 		  (or (get-lru-window frame-to-use)
! 		      (get-buffer-window buffer 'visible)
! 		      (get-largest-window 'visible)
! 		      (get-buffer-window buffer 0)
! 		      (get-largest-window 0)
! 		      (frame-selected-window (funcall pop-up-frame-function))))
! 	  (when (window-live-p window-to-undedicate)
! 	    ;; Restore dedicated status of selected window.
! 	    (set-window-dedicated-p window-to-undedicate nil))))
        (window--even-window-heights window-to-use)
        (window--display-buffer-2 buffer window-to-use)))))
  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#1415: 23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument
  2008-11-24  9:59   ` martin rudalics
@ 2008-11-26 21:13     ` Helmut Eller
  0 siblings, 0 replies; 4+ messages in thread
From: Helmut Eller @ 2008-11-26 21:13 UTC (permalink / raw)
  To: martin rudalics; +Cc: 1415

* martin rudalics [2008-11-24 10:59+0100] writes:

>
> Nice bug.  Thanks for the precise report and test case!
>
> Emacs 22 handled this, but I'm too lazy to figure out how.
>
> Please try the attached patch.

I've used the patch now for two days and it seems to work well.

Thank you for the quick fix.

Helmut.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#1415: marked as done (23.0.60; display-buffer doesn't honor  NOT-THIS-WINDOW argument)
  2008-11-22 17:01 ` bug#1415: 23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument Helmut Eller
  2008-11-24  9:59   ` martin rudalics
@ 2008-11-27 13:55   ` Emacs bug Tracking System
  1 sibling, 0 replies; 4+ messages in thread
From: Emacs bug Tracking System @ 2008-11-27 13:55 UTC (permalink / raw)
  To: martin rudalics

[-- Attachment #1: Type: text/plain, Size: 891 bytes --]


Your message dated Thu, 27 Nov 2008 14:41:11 +0100
with message-id <492EA377.40504@gmx.at>
and subject line Re: bug#1415: 23.0.60;	display-buffer doesn't honor NOT-THIS-WINDOW argument
has caused the Emacs bug report #1415,
regarding 23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
1415: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=1415
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 2979 bytes --]

From: Helmut Eller <eller.helmut@gmail.com>
To: emacs-pretest-bug@gnu.org
Subject: 23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument
Date: Sat, 22 Nov 2008 18:01:37 +0100
Message-ID: <m24p1zofta.fsf@gmail.com>


I think that display-buffer returns sometimes the selected window even
if the NOT-THIS-WINDOW argument is true.  Here is a test case:

(progn
  (defun display-buffer-checked (buffer)
    (let ((selected (selected-window))
          (window (display-buffer buffer t)))
      (when (eq selected window)
        (error "display-buffer returned selected window"))
      window))
  
  (let ((foo (get-buffer-create "foo"))
        (bar (get-buffer-create "bar")))
    (select-window (get-buffer-window "*scratch*"))
    (save-selected-window 
      (select-window (display-buffer-checked foo)))
    (save-selected-window 
      (select-window (display-buffer-checked bar)))))


display-buffer-checked just calls display-buffer and checks that the
returned window isn't the selected window.  From looking at the code of
display-buffer, I would say that display-buffer returns the lru window
even if that's the selected window.

Helmut.


In GNU Emacs 23.0.60.10 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2008-11-22 on xaital
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--without-sound' '--without-pop' '--without-gif' '--without-tiff''



[-- Attachment #3: Type: message/rfc822, Size: 1708 bytes --]

From: martin rudalics <rudalics@gmx.at>
To: 1415-done@emacsbugs.donarmstrong.com
Cc: Helmut Eller <eller.helmut@gmail.com>
Subject: Re: bug#1415: 23.0.60;	display-buffer doesn't honor NOT-THIS-WINDOW argument
Date: Thu, 27 Nov 2008 14:41:11 +0100
Message-ID: <492EA377.40504@gmx.at>

> I've used the patch now for two days and it seems to work well.

I've checked in a slightly more restrictive version.
Please try again and keep an eye on this.

Thanks again for reporting, martin.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-27 13:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <492EA377.40504@gmx.at>
2008-11-22 17:01 ` bug#1415: 23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument Helmut Eller
2008-11-24  9:59   ` martin rudalics
2008-11-26 21:13     ` Helmut Eller
2008-11-27 13:55   ` bug#1415: marked as done (23.0.60; display-buffer doesn't honor NOT-THIS-WINDOW argument) Emacs bug Tracking System

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).