struct buffer *old_buffer = NULL, *b = XBUFFER (buf);
/* In case W->start is out of the range, use something
- reasonable. This situation occured when loading a file with
+ reasonable. This situation occurred when loading a file with
`-l' containing a call to `rmail' with subsequent other
commands. At the end, W->start happened to be BEG, while
rmail had already narrowed the buffer. */
{
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.
+If WINDOW's frame is the selected frame, 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)
selected_window = window;
sf = SELECTED_FRAME ();
- if (XFRAME (WINDOW_FRAME (w)) != sf)
- {
- XFRAME (WINDOW_FRAME (w))->selected_window = window;
- /* Use this rather than Fhandle_switch_frame
- so that FRAME_FOCUS_FRAME is moved appropriately as we
- move around in the state where a minibuffer in a separate
- frame is active. */
- Fselect_frame (WINDOW_FRAME (w), Qnil);
- }
- else
+ if (XFRAME (WINDOW_FRAME (w)) == sf)
sf->selected_window = window;
if (recordflag)
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))
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;
Lisp_Object n;
int direction;
{
- int count = BINDING_STACK_SIZE ();
+ int count = SPECPDL_INDEX ();
xassert (abs (direction) == 1);
{
Lisp_Object window;
struct window *w;
- int count = BINDING_STACK_SIZE ();
+ int count = SPECPDL_INDEX ();
window = Fother_window_for_scrolling ();
w = XWINDOW (window);
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)
{
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));