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"
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\