aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-03-17 06:48:12 +0000
committerRichard M. Stallman1998-03-17 06:48:12 +0000
commit478292ed62324ae671be09f083ce90227ae6ee5e (patch)
treea0b13ae77aecc1e1df16680befa59f961650eeaa
parent6d2c8e3eb7baecca2fccdf8178985d33484cd4d5 (diff)
downloademacs-478292ed62324ae671be09f083ce90227ae6ee5e.tar.gz
emacs-478292ed62324ae671be09f083ce90227ae6ee5e.zip
(Frecenter): Operate on window's buffer even if some other was current.
(Fwindow_end): New arg UPDATE. (Fset_window_configuration): Don't call do_switch_frame or run Qwindow_configuration_change_hook if frame is dead.
-rw-r--r--src/window.c62
1 files changed, 40 insertions, 22 deletions
diff --git a/src/window.c b/src/window.c
index 1a6e7edd887..f7e1e24bdc1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -561,13 +561,15 @@ have been if redisplay had finished, do this:\n\
561 (vertical-motion (1- (window-height window)) window)\n\ 561 (vertical-motion (1- (window-height window)) window)\n\
562 (point))") */ 562 (point))") */
563 563
564DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 1, 0, 564DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 2, 0,
565 "Return position at which display currently ends in WINDOW.\n\ 565 "Return position at which display currently ends in WINDOW.\n\
566This is updated by redisplay, when it runs to completion.\n\ 566This is updated by redisplay, when it runs to completion.\n\
567Simply changing the buffer text or setting `window-start'\n\ 567Simply changing the buffer text or setting `window-start'\n\
568does not update this value.") 568does not update this value.\n\
569 (window) 569If UP-TO-DATE is non-nil, compute the up-to-date position\n\
570 Lisp_Object window; 570if it isn't already recorded.")
571 (window, update)
572 Lisp_Object window, update;
571{ 573{
572 Lisp_Object value; 574 Lisp_Object value;
573 struct window *w = decode_window (window); 575 struct window *w = decode_window (window);
@@ -585,8 +587,20 @@ does not update this value.")
585 return Qnil; 587 return Qnil;
586#endif 588#endif
587 589
588 XSETINT (value, 590 if (! NILP (update)
589 BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); 591 && ! (! NILP (w->window_end_valid)
592 && XFASTINT (w->last_modified) >= MODIFF))
593 {
594 int opoint = PT, opoint_byte = PT_BYTE;
595 TEMP_SET_PT_BOTH (XMARKER (w->start)->charpos,
596 XMARKER (w->start)->bytepos);
597 Fvertical_motion (make_number (window_internal_height (w)), Qnil);
598 XSETINT (value, PT);
599 TEMP_SET_PT_BOTH (opoint, opoint_byte);
600 }
601 else
602 XSETINT (value,
603 BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
590 604
591 return value; 605 return value;
592} 606}
@@ -3105,6 +3119,8 @@ redraws with point in the center of the current window.")
3105 register struct window *w = XWINDOW (selected_window); 3119 register struct window *w = XWINDOW (selected_window);
3106 register int ht = window_internal_height (w); 3120 register int ht = window_internal_height (w);
3107 struct position pos; 3121 struct position pos;
3122 struct buffer *buf = XBUFFER (w->buffer);
3123 struct buffer *obuf = current_buffer;
3108 3124
3109 if (NILP (arg)) 3125 if (NILP (arg))
3110 { 3126 {
@@ -3126,6 +3142,7 @@ redraws with point in the center of the current window.")
3126 if (XINT (arg) < 0) 3142 if (XINT (arg) < 0)
3127 XSETINT (arg, XINT (arg) + ht); 3143 XSETINT (arg, XINT (arg) + ht);
3128 3144
3145 set_buffer_internal (buf);
3129 pos = *vmotion (PT, - XINT (arg), w); 3146 pos = *vmotion (PT, - XINT (arg), w);
3130 3147
3131 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); 3148 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos);
@@ -3133,6 +3150,7 @@ redraws with point in the center of the current window.")
3133 || FETCH_BYTE (pos.bytepos - 1) == '\n') 3150 || FETCH_BYTE (pos.bytepos - 1) == '\n')
3134 ? Qt : Qnil); 3151 ? Qt : Qnil);
3135 w->force_start = Qt; 3152 w->force_start = Qt;
3153 set_buffer_internal (obuf);
3136 3154
3137 return Qnil; 3155 return Qnil;
3138} 3156}
@@ -3441,19 +3459,19 @@ by `current-window-configuration' (which see).")
3441#endif 3459#endif
3442 3460
3443 UNBLOCK_INPUT; 3461 UNBLOCK_INPUT;
3444 }
3445 3462
3446 /* Restore the minimum heights recorded in the configuration. */ 3463 /* Fselect_window will have made f the selected frame, so we
3447 window_min_height = XINT (data->min_height); 3464 reselect the proper frame here. Fhandle_switch_frame will change the
3448 window_min_width = XINT (data->min_width); 3465 selected window too, but that doesn't make the call to
3466 Fselect_window above totally superfluous; it still sets f's
3467 selected window. */
3468 if (FRAME_LIVE_P (XFRAME (data->selected_frame)))
3469 do_switch_frame (data->selected_frame, Qnil, 0);
3449 3470
3450 /* Fselect_window will have made f the selected frame, so we 3471 if (! NILP (Vwindow_configuration_change_hook)
3451 reselect the proper frame here. Fhandle_switch_frame will change the 3472 && ! NILP (Vrun_hooks))
3452 selected window too, but that doesn't make the call to 3473 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
3453 Fselect_window above totally superfluous; it still sets f's 3474 }
3454 selected window. */
3455 if (FRAME_LIVE_P (XFRAME (data->selected_frame)))
3456 do_switch_frame (data->selected_frame, Qnil, 0);
3457 3475
3458 if (!NILP (new_current_buffer)) 3476 if (!NILP (new_current_buffer))
3459 { 3477 {
@@ -3466,13 +3484,13 @@ by `current-window-configuration' (which see).")
3466 SET_PT (old_point); 3484 SET_PT (old_point);
3467 } 3485 }
3468 3486
3469 Vminibuf_scroll_window = data->minibuf_scroll_window; 3487 /* Restore the minimum heights recorded in the configuration. */
3488 window_min_height = XINT (data->min_height);
3489 window_min_width = XINT (data->min_width);
3470 3490
3471 if (! NILP (Vwindow_configuration_change_hook) 3491 Vminibuf_scroll_window = data->minibuf_scroll_window;
3472 && ! NILP (Vrun_hooks))
3473 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
3474 3492
3475 return (Qnil); 3493 return Qnil;
3476} 3494}
3477 3495
3478/* Mark all windows now on frame as deleted 3496/* Mark all windows now on frame as deleted