Commit 75d8f668 authored by Jim Blandy's avatar Jim Blandy

Don't let the 'B' interactive spec default to buffers viewed in

	any visible frame.
	* buffer.c (Fother_buffer): Pass Qvisible as the second argument
	to Fget_buffer_window.
	* window.c (Qvisible): New symbol.
	(window_loop): In GET_BUFFER_WINDOW case, if frames is Qvisible,
	ignore non-visible frames.
	(Fget_buffer_window): Expand doc string to mention that Qvisible
	is an interesting value for FRAME argument.
	(syms_of_window): Init and staticpro Qvisible.
	* lisp.h (Qvisible): New declaration.
parent 2b0f4ba5
...@@ -585,7 +585,7 @@ If BUFFER is omitted or nil, some interesting buffer is returned.") ...@@ -585,7 +585,7 @@ If BUFFER is omitted or nil, some interesting buffer is returned.")
if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ')
continue; continue;
if (NILP (visible_ok)) if (NILP (visible_ok))
tem = Fget_buffer_window (buf, Qnil); tem = Fget_buffer_window (buf, Qvisible);
else else
tem = Qnil; tem = Qnil;
if (NILP (tem)) if (NILP (tem))
......
...@@ -1213,7 +1213,7 @@ extern Lisp_Object get_keyelt (), get_keymap(); ...@@ -1213,7 +1213,7 @@ extern Lisp_Object get_keyelt (), get_keymap();
extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column (); extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column ();
/* defined in window.c */ /* defined in window.c */
extern Lisp_Object Qwindowp, Qwindow_live_p; extern Lisp_Object Qwindowp, Qwindow_live_p, Qvisible;
extern Lisp_Object Fget_buffer_window (); extern Lisp_Object Fget_buffer_window ();
extern Lisp_Object Fsave_window_excursion (); extern Lisp_Object Fsave_window_excursion ();
extern Lisp_Object Fset_window_configuration (), Fcurrent_window_configuration (); extern Lisp_Object Fset_window_configuration (), Fcurrent_window_configuration ();
......
...@@ -30,6 +30,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -30,6 +30,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "keyboard.h" #include "keyboard.h"
Lisp_Object Qwindowp, Qwindow_live_p; Lisp_Object Qwindowp, Qwindow_live_p;
Lisp_Object Qvisible;
Lisp_Object Fnext_window (), Fdelete_window (), Fselect_window (); Lisp_Object Fnext_window (), Fdelete_window (), Fselect_window ();
Lisp_Object Fset_window_buffer (), Fsplit_window (), Frecenter (); Lisp_Object Fset_window_buffer (), Fsplit_window (), Frecenter ();
...@@ -1057,8 +1058,10 @@ argument ALL_FRAMES is non-nil, cycle through all frames.") ...@@ -1057,8 +1058,10 @@ argument ALL_FRAMES is non-nil, cycle through all frames.")
/* Look at all windows, performing an operation specified by TYPE /* Look at all windows, performing an operation specified by TYPE
with argument OBJ. with argument OBJ.
If FRAMES is Qt, look at all frames, if Qnil, look at just the selected If FRAMES is Qt, look at all frames;
frame. If FRAMES is a frame, just look at windows on that frame. Qvisible, look at visible frames (GET_BUFFER_WINDOW only);
Qnil, look at just the selected frame;
a frame, just look at windows on that frame.
If MINI is non-zero, perform the operation on minibuffer windows too. If MINI is non-zero, perform the operation on minibuffer windows too.
*/ */
...@@ -1126,6 +1129,8 @@ window_loop (type, obj, mini, frames) ...@@ -1126,6 +1129,8 @@ window_loop (type, obj, mini, frames)
best_window = Qnil; best_window = Qnil;
for (;;) for (;;)
{ {
FRAME_PTR w_frame = XFRAME (WINDOW_FRAME (XWINDOW (w)));
/* Pick the next window now, since some operations will delete /* Pick the next window now, since some operations will delete
the current window. */ the current window. */
#ifdef MULTI_FRAME #ifdef MULTI_FRAME
...@@ -1137,17 +1142,16 @@ window_loop (type, obj, mini, frames) ...@@ -1137,17 +1142,16 @@ window_loop (type, obj, mini, frames)
Or we know this isn't a MULTI_FRAME Emacs, so who cares? */ Or we know this isn't a MULTI_FRAME Emacs, so who cares? */
next_window = Fnext_window (w, mini ? Qt : Qnil, Qt); next_window = Fnext_window (w, mini ? Qt : Qnil, Qt);
if (!MINI_WINDOW_P (XWINDOW (w)) if (! MINI_WINDOW_P (XWINDOW (w))
|| (mini && minibuf_level > 0)) || (mini && minibuf_level > 0))
switch (type) switch (type)
{ {
case GET_BUFFER_WINDOW: case GET_BUFFER_WINDOW:
#if 0 /* Perhaps ignore invisible and iconified frames. */
/* Ignore invisible and iconified frames. */ if (EQ (frames, Qvisible)
if (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (w)))) && (! FRAME_VISIBLE_P (w_frame)
|| FRAME_ICONIFIED_P (XFRAME (WINDOW_FRAME (XWINDOW (w))))) || FRAME_ICONIFIED_P (w_frame)))
break; break;
#endif
if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj)) if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj))
return w; return w;
break; break;
...@@ -1272,8 +1276,9 @@ frame, search only that frame.\n") ...@@ -1272,8 +1276,9 @@ frame, search only that frame.\n")
DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0,
"Return a window currently displaying BUFFER, or nil if none.\n\ "Return a window currently displaying BUFFER, or nil if none.\n\
If optional argument FRAMES is t, search all frames. If FRAME is a\n\ If optional argument FRAME is t, search all frames.\n\
frame, search only that frame.\n") If FRAME is `visible', search all visible frames.\n\
If FRAME is a frame, search only that frame.\n")
(buffer, frame) (buffer, frame)
Lisp_Object buffer, frame; Lisp_Object buffer, frame;
{ {
...@@ -2896,6 +2901,9 @@ syms_of_window () ...@@ -2896,6 +2901,9 @@ syms_of_window ()
Qwindow_live_p = intern ("window-live-p"); Qwindow_live_p = intern ("window-live-p");
staticpro (&Qwindow_live_p); staticpro (&Qwindow_live_p);
Qvisible = intern ("Qvisible");
staticpro (&Qvisible);
#ifndef MULTI_FRAME #ifndef MULTI_FRAME
/* Make sure all windows get marked */ /* Make sure all windows get marked */
staticpro (&minibuf_window); staticpro (&minibuf_window);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment