unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6400: I want to stay with a sibling window
@ 2010-06-11  8:27 Lennart Borgman
  2010-06-11 13:22 ` martin rudalics
  2011-10-11  9:31 ` martin rudalics
  0 siblings, 2 replies; 5+ messages in thread
From: Lennart Borgman @ 2010-06-11  8:27 UTC (permalink / raw)
  To: 6400

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

A small patch to make the selected window one of the siblings when the
selected window is deleted.

I do not understand the code so I am not sure this is correct. Martin?

[-- Attachment #2: window-del-sel-sibling-1.diff --]
[-- Type: text/x-patch, Size: 1381 bytes --]

=== modified file 'src/window.c'
--- trunk/src/window.c	2010-06-07 18:28:02 +0000
+++ patched/src/window.c	2010-06-11 08:17:43 +0000
@@ -1563,6 +1563,7 @@
   register struct window *p;
   register struct window *par;
   struct frame *f;
+  int did_select = 0;
 
   /* Because this function is called by other C code on non-leaf
      windows, the CHECK_LIVE_WINDOW macro would choke inappropriately,
@@ -1628,7 +1629,10 @@
 	   delete the selected window on any other frame, we shouldn't do
 	   anything but set the frame's selected_window slot.  */
 	if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))
-	  Fselect_window (swindow, Qnil);
+          {
+            Fselect_window (swindow, Qnil);
+            did_select = 1;
+          }
 	else
 	  FRAME_SELECTED_WINDOW (f) = swindow;
       }
@@ -1758,6 +1762,10 @@
   /* Adjust glyph matrices. */
   adjust_glyphs (f);
   UNBLOCK_INPUT;
+
+  if (did_select)
+    if (!NILP (sib))
+      Fselect_window (sib, Qnil);
 }
 
 
@@ -3765,7 +3773,7 @@
       window = display_buffer (buf, Qnil, Qnil);
 
       if (!EQ (XWINDOW (window)->frame, selected_frame))
-	Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
+	Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)), Qnil);
       Vminibuf_scroll_window = window;
       w = XWINDOW (window);
       XSETFASTINT (w->hscroll, 0);


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

* bug#6400: I want to stay with a sibling window
  2010-06-11  8:27 bug#6400: I want to stay with a sibling window Lennart Borgman
@ 2010-06-11 13:22 ` martin rudalics
  2010-06-11 17:04   ` Lennart Borgman
  2011-10-11  9:31 ` martin rudalics
  1 sibling, 1 reply; 5+ messages in thread
From: martin rudalics @ 2010-06-11 13:22 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs Bugs

 > A small patch to make the selected window one of the siblings when the
 > selected window is deleted.
 >
 > I do not understand the code so I am not sure this is correct. Martin?

  	if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))

This conditional checks only whether f is the selected frame.  You
probably want to make sib the frame's selected window whenever you
delete the frame's selected window.

        if (!EQ (XWINDOW (window)->frame, selected_frame))
-	Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
+	Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)), Qnil);

And you almost certainly want to tell us what this is meant for ;-)

martin





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

* bug#6400: I want to stay with a sibling window
  2010-06-11 13:22 ` martin rudalics
@ 2010-06-11 17:04   ` Lennart Borgman
  2010-06-11 17:13     ` martin rudalics
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman @ 2010-06-11 17:04 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Bugs

On Fri, Jun 11, 2010 at 3:22 PM, martin rudalics <rudalics@gmx.at> wrote:
>> A small patch to make the selected window one of the siblings when the
>> selected window is deleted.
>>
>> I do not understand the code so I am not sure this is correct. Martin?
>
>        if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))
>
> This conditional checks only whether f is the selected frame.  You
> probably want to make sib the frame's selected window whenever you
> delete the frame's selected window.


Yes, that is what I want.

There is a bug in the patch. I assumed that if "sib" was non-nil then
it would be a buffer window. That is not the case so a check of that
must be made. The most simple is to add another check with
WINDOW_LIVE_P.


>       if (!EQ (XWINDOW (window)->frame, selected_frame))
> -       Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
> +       Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)), Qnil);
>
> And you almost certainly want to tell us what this is meant for ;-)


Eh, forgot I had this little patch there... ;-)

I have added a second optional arg to make-frame-visible:
dont-activate. This is for use with top-most windows etc. I will come
back to that when I have time.





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

* bug#6400: I want to stay with a sibling window
  2010-06-11 17:04   ` Lennart Borgman
@ 2010-06-11 17:13     ` martin rudalics
  0 siblings, 0 replies; 5+ messages in thread
From: martin rudalics @ 2010-06-11 17:13 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs Bugs

 > There is a bug in the patch. I assumed that if "sib" was non-nil then
 > it would be a buffer window. That is not the case so a check of that
 > must be made. The most simple is to add another check with
 > WINDOW_LIVE_P.

Indeed.  BTW note that the entire job of finding swindow was already
geared towards making the deletion of internal windows possible.

martin





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

* bug#6400: I want to stay with a sibling window
  2010-06-11  8:27 bug#6400: I want to stay with a sibling window Lennart Borgman
  2010-06-11 13:22 ` martin rudalics
@ 2011-10-11  9:31 ` martin rudalics
  1 sibling, 0 replies; 5+ messages in thread
From: martin rudalics @ 2011-10-11  9:31 UTC (permalink / raw)
  To: 6400-done

 > A small patch to make the selected window one of the siblings when the
 > selected window is deleted.

When the selected window is deleted emacs now selects the most recently
selected live window on that frame instead.

martin





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

end of thread, other threads:[~2011-10-11  9:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-11  8:27 bug#6400: I want to stay with a sibling window Lennart Borgman
2010-06-11 13:22 ` martin rudalics
2010-06-11 17:04   ` Lennart Borgman
2010-06-11 17:13     ` martin rudalics
2011-10-11  9:31 ` martin rudalics

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