along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include "config.h"
+#include <config.h>
#include "lisp.h"
#include "buffer.h"
#include "frame.h"
#include "keyboard.h"
Lisp_Object Qwindowp, Qwindow_live_p;
-Lisp_Object Qvisible;
Lisp_Object Fnext_window (), Fdelete_window (), Fselect_window ();
Lisp_Object Fset_window_buffer (), Fsplit_window (), Frecenter ();
{
Lisp_Object value;
struct window *w = decode_window (window);
-
+ Lisp_Object buf;
+
+ buf = w->buffer;
+ CHECK_BUFFER (buf, 0);
+
XSET (value, Lisp_Int,
- BUF_Z (current_buffer) - XFASTINT (w->window_end_pos));
+ BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
return value;
}
extern Lisp_Object next_frame (), prev_frame ();
-DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0,
+/* This comment supplies the doc string for `next-window',
+ for make-docfile to see. We cannot put this in the real DEFUN
+ due to limits in the Unix cpp.
+
+DEFUN ("next-window", Ffoo, Sfoo, 0, 3, 0,
"Return next window after WINDOW in canonical ordering of windows.\n\
If omitted, WINDOW defaults to the selected window.\n\
\n\
`next-window' to iterate through the entire cycle of acceptable\n\
windows, eventually ending up back at the window you started with.\n\
`previous-window' traverses the same cycle, in the reverse order.")
+ (window, minibuf, all_frames) */
+
+DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0,
+ 0)
(window, minibuf, all_frames)
register Lisp_Object window, minibuf, all_frames;
{
return window;
}
-DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0,
+/* This comment supplies the doc string for `previous-window',
+ for make-docfile to see. We cannot put this in the real DEFUN
+ due to limits in the Unix cpp.
+
+DEFUN ("previous-window", Ffoo, Sfoo, 0, 3, 0,
"Return the window preceeding WINDOW in canonical ordering of windows.\n\
If omitted, WINDOW defaults to the selected window.\n\
\n\
`previous-window' to iterate through the entire cycle of acceptable\n\
windows, eventually ending up back at the window you started with.\n\
`next-window' traverses the same cycle, in the reverse order.")
+ (window, minibuf, all_frames) */
+
+
+DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0,
+ 0)
(window, minibuf, all_frames)
register Lisp_Object window, minibuf, all_frames;
{
/* Look at all windows, performing an operation specified by TYPE
with argument OBJ.
If FRAMES is Qt, look at all frames;
- 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.
DELETE_OTHER_WINDOWS, /* Arg is window not to delete */
DELETE_BUFFER_WINDOWS, /* Arg is buffer */
GET_LARGEST_WINDOW,
- UNSHOW_BUFFER, /* Arg is buffer */
+ UNSHOW_BUFFER /* Arg is buffer */
};
static Lisp_Object
switch (type)
{
case GET_BUFFER_WINDOW:
- /* Perhaps ignore invisible and iconified frames. */
- if (EQ (frames, Qvisible)
- && (! FRAME_VISIBLE_P (w_frame)
- || FRAME_ICONIFIED_P (w_frame)))
+ /* Ignore invisible and iconified frames. */
+ if (! FRAME_VISIBLE_P (w_frame)
+ || FRAME_ICONIFIED_P (w_frame))
break;
if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj))
return w;
new_buffer
= Fget_buffer_create (build_string ("*scratch*"));
Fset_window_buffer (w, new_buffer);
- Fset_buffer (XWINDOW (w)->buffer);
+ if (EQ (w, selected_window))
+ Fset_buffer (XWINDOW (w)->buffer);
}
else
Fdelete_window (w);
DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0,
"Return a window currently displaying BUFFER, or nil if none.\n\
-If optional argument FRAME is t, search all frames.\n\
-If FRAME is `visible', search all visible frames.\n\
+If optional argument FRAME is t, search all visible frames.\n\
+If FRAME is nil, search only the selected frame.\n\
If FRAME is a frame, search only that frame.\n")
(buffer, frame)
Lisp_Object buffer, frame;
DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows,
0, 1, "",
"Make WINDOW (or the selected window) fill its frame.\n\
-Only the frame WINDOW is on is affected.")
+Only the frame WINDOW is on is affected.\n\
+This function tries to reduce display jumps\n\
+by keeping the text previously visible in WINDOW\n\
+in the same place on the frame. Doing this depends on\n\
+the value of (window-start WINDOW), so if calling this function\n\
+in a program gives strange scrolling, make sure the window-start\n\
+value is reasonable when this function is called.")
(window)
Lisp_Object window;
{
struct window *w;
- int opoint = point;
struct buffer *obuf = current_buffer;
+ int opoint;
int top;
if (NILP (window))
window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w));
Fset_buffer (w->buffer);
+ opoint = point;
SET_PT (marker_position (w->start));
Frecenter (make_number (top - FRAME_MENU_BAR_LINES (XFRAME (WINDOW_FRAME (w)))));
- set_buffer_internal (obuf);
SET_PT (opoint);
+ set_buffer_internal (obuf);
return Qnil;
}
DEFUN ("delete-windows-on", Fdelete_windows_on, Sdelete_windows_on,
- 1, 1, "bDelete windows on (buffer): ",
- "Delete all windows showing BUFFER.")
- (buffer)
- Lisp_Object buffer;
+ 1, 2, "bDelete windows on (buffer): ",
+ "Delete all windows showing BUFFER.\n\
+Optional second argument FRAME controls which frames are affected.\n\
+If nil or omitted, delete all windows showing BUFFER in any frame.\n\
+If t, delete only windows showing BUFFER in the selected frame.\n\
+If a frame, delete only windows showing BUFFER in that frame.")
+ (buffer, frame)
+ Lisp_Object buffer, frame;
{
+#ifdef MULTI_FRAME
+ /* FRAME uses t and nil to mean the opposite of what window_loop
+ expects. */
+ if (! FRAMEP (frame))
+ frame = NILP (frame) ? Qt : Qnil;
+#else
+ frame = Qt;
+#endif
+
if (!NILP (buffer))
{
buffer = Fget_buffer (buffer);
CHECK_BUFFER (buffer, 0);
- window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, Qt);
+ window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame);
}
return Qnil;
}
FRAME_PTR frame;
int *rows, *cols;
{
- /* For height, we have to see whether the frame has a minibuffer, and
- whether it wants a mode line. */
+ /* For height, we have to see:
+ whether the frame has a minibuffer,
+ whether it wants a mode line, and
+ whether it has a menu bar. */
int min_height =
(FRAME_MINIBUF_ONLY_P (frame) ? MIN_SAFE_WINDOW_HEIGHT - 1
: (! FRAME_HAS_MINIBUF_P (frame)) ? MIN_SAFE_WINDOW_HEIGHT
: 2 * MIN_SAFE_WINDOW_HEIGHT - 1);
+ if (FRAME_MENU_BAR_LINES (frame) > 0)
+ min_height += FRAME_MENU_BAR_LINES (frame);
if (*rows < min_height)
*rows = min_height;
}
w->buffer = buffer;
+ w->window_end_pos = 0;
+ w->window_end_valid = Qnil;
w->hscroll = 0;
Fset_marker (w->pointm,
make_number (BUF_PT (XBUFFER (buffer))),
Qwindow_live_p = intern ("window-live-p");
staticpro (&Qwindow_live_p);
- Qvisible = intern ("Qvisible");
- staticpro (&Qvisible);
-
#ifndef MULTI_FRAME
/* Make sure all windows get marked */
staticpro (&minibuf_window);