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"
{
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;
}
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
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 ("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): ",
+ 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\
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))),