if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w))
break;
/* Ignore dedicated windows and minibuffers. */
- if (MINI_WINDOW_P (w) || !NILP (w->dedicated))
+ if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt))
break;
if (NILP (best_window)
|| (XFASTINT (XWINDOW (best_window)->use_time)
case GET_LARGEST_WINDOW:
{
/* Ignore dedicated windows and minibuffers. */
- if (MINI_WINDOW_P (w) || !NILP (w->dedicated))
+ if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt))
break;
if (NILP (best_window))
/* Now we can safely delete the frame. */
Fdelete_frame (w->frame, Qnil);
}
+ else if (!NILP (w->dedicated) && !NILP (w->parent))
+ {
+ Lisp_Object window;
+ XSETWINDOW (window, w);
+ /* If this window is dedicated and not the only window
+ in its frame, then kill it. */
+ Fdelete_window (window);
+ }
else
{
/* Otherwise show a different buffer in the window. */
{
struct window *w = XWINDOW (window);
struct buffer *b = XBUFFER (buffer);
- int count = specpdl_ptr - specpdl;
+ int count = SPECPDL_INDEX ();
w->buffer = buffer;
{
if (!NILP (w->dedicated) && !EQ (tem, buffer))
error ("Window is dedicated to `%s'",
- XSTRING (XBUFFER (tem)->name)->data);
+ SDATA (XBUFFER (tem)->name));
unshow_buffer (w);
}
DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0,
doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer.
If WINDOW is not already selected, also make WINDOW's buffer current.
+Also make WINDOW the frame's selected window.
+
Note that the main editor command loop
selects the buffer of the selected window before each command. */)
(window)
frames = Qnil;
if (FRAME_MINIBUF_ONLY_P (f))
XSETFRAME (frames, last_nonminibuf_frame);
- /* Don't try to create a window if would get an error */
+ /* Don't try to create a window if we would get an error. */
if (split_height_threshold < window_min_height << 1)
split_height_threshold = window_min_height << 1;
BEGV = BEG;
ZV = Z;
SET_PT (BEG);
+#if 0 /* rms: there should be no reason for this. */
XBUFFER (buf)->prevent_redisplay_optimizations_p = 1;
+#endif
set_buffer_internal (old);
if (!EQ (Vtemp_buffer_show_function, Qnil))
set_marker_restricted_both (w->pointm, buf, 1, 1);
/* Run temp-buffer-show-hook, with the chosen window selected
- and it sbuffer current. */
+ and its buffer current. */
if (!NILP (Vrun_hooks))
{
Lisp_Object tem;
tem = Fsymbol_value (Qtemp_buffer_show_hook);
if (!NILP (tem))
{
- int count = specpdl_ptr - specpdl;
+ int count = SPECPDL_INDEX ();
Lisp_Object prev_window;
prev_window = selected_window;
/* Select the window that was chosen, for running the hook. */
+ /* Both this Fselect_window and the select_window_1
+ below will (may) incorrectly set-buffer to the buffer
+ displayed in the window. --stef */
record_unwind_protect (Fselect_window, prev_window);
select_window_1 (window, 0);
Fset_buffer (w->buffer);
return Qnil;
}
-DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p",
+DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 3, "p",
doc: /* Make current window ARG lines smaller.
From program, optional second arg non-nil means shrink sideways arg columns.
-Interactively, if an argument is not given, make the window one line smaller. */)
- (arg, side)
- register Lisp_Object arg, side;
+Interactively, if an argument is not given, make the window one line smaller.
+
+Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size
+of the siblings above or to the left of the selected window. Only
+siblings to the right or below are changed. */)
+ (arg, side, preserve_before)
+ register Lisp_Object arg, side, preserve_before;
{
CHECK_NUMBER (arg);
- enlarge_window (selected_window, -XINT (arg), !NILP (side), 0);
+ enlarge_window (selected_window, -XINT (arg), !NILP (side),
+ !NILP (preserve_before));
if (! NILP (Vwindow_configuration_change_hook))
call1 (Vrun_hooks, Qwindow_configuration_change_hook);
delta1/n = delta
delta1 = n * delta.
- The number of children n rquals the number of resizable
+ The number of children n equals the number of resizable
children of this window + 1 because we know window itself
is resizable (otherwise we would have signalled an error. */
int whole;
int noerror;
{
+ immediate_quit = 1;
+
/* If we must, use the pixel-based version which is much slower than
the line-based one but can handle varying line heights. */
if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame)))
window_scroll_pixel_based (window, n, whole, noerror);
else
window_scroll_line_based (window, n, whole, noerror);
+
+ immediate_quit = 0;
}
else
move_it_by_lines (&it, n, 1);
- /* End if we end up at ZV or BEGV. */
+ /* We failed if we find ZV is already on the screen (scrolling up,
+ means there's nothing past the end), or if we can't start any
+ earlier (scrolling down, means there's nothing past the top). */
if ((n > 0 && IT_CHARPOS (it) == ZV)
|| (n < 0 && IT_CHARPOS (it) == CHARPOS (start)))
{
if (IT_CHARPOS (it) == ZV)
{
- if (it.current_y + it.max_ascent + it.max_descent
- > it.last_visible_y)
+ if (it.current_y < it.last_visible_y
+ && (it.current_y + it.max_ascent + it.max_descent
+ >= it.last_visible_y))
{
/* The last line was only partially visible, make it fully
visible. */
move_it_vertically (&it, height);
bottom_y = line_bottom_y (&it);
+ /* rms: On a non-window display,
+ the value of it.vpos at the bottom of the screen
+ seems to be 1 larger than window_box_height (w).
+ This kludge fixes a bug whereby (move-to-window-line -1)
+ when ZV is on the last screen line
+ moves to the previous screen line instead of the last one. */
+ if (! FRAME_WINDOW_P (XFRAME (w->frame)))
+ height++;
+
/* Add in empty lines at the bottom of the window. */
if (bottom_y < height)
{
if (NILP (XBUFFER (new_current_buffer)->name))
new_current_buffer = Qnil;
else
- old_point = BUF_PT (XBUFFER (new_current_buffer));
+ {
+ if (XBUFFER (new_current_buffer) == current_buffer)
+ old_point = PT;
+ else
+ old_point = BUF_PT (XBUFFER (new_current_buffer));
+ }
frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
f = XFRAME (frame);
Lisp_Object args;
{
register Lisp_Object val;
- register int count = specpdl_ptr - specpdl;
+ register int count = SPECPDL_INDEX ();
record_unwind_protect (Fset_window_configuration,
Fcurrent_window_configuration (Qnil));
doc: /* Function to call to make a new frame for a special buffer.
It is called with two arguments, the buffer and optional buffer specific
data, and should return a window displaying that buffer.
-The default value makes a separate frame for the buffer,
-using `special-display-frame-alist' to specify the frame parameters.
-
-A buffer is special if its is listed in `special-display-buffer-names'
+The default value normally makes a separate frame for the buffer,
+ using `special-display-frame-alist' to specify the frame parameters.
+But if the buffer specific data includes (same-buffer . t) then the
+ buffer is displayed in the current selected window.
+Otherwise if it includes (same-frame . t) then the buffer is displayed in
+ a new window in the currently selected frame.
+
+A buffer is special if it is listed in `special-display-buffer-names'
or matches a regexp in `special-display-regexps'. */);
Vspecial_display_function = Qnil;