diff options
| author | Joakim Verona | 2012-07-27 02:22:03 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-07-27 02:22:03 +0200 |
| commit | 5fb63197843dcae66f2fe0ddd6f4a9d560e9db2f (patch) | |
| tree | 5c55f1096a656a9759f0b53a0b5d1a2289bd366f /src/window.c | |
| parent | 0c5c85cf2b350c965bb1ffa5b2d77c2adebc406b (diff) | |
| parent | 562157c814037dcba58a20cd6908a95992c22283 (diff) | |
| download | emacs-5fb63197843dcae66f2fe0ddd6f4a9d560e9db2f.tar.gz emacs-5fb63197843dcae66f2fe0ddd6f4a9d560e9db2f.zip | |
upstream
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 247 |
1 files changed, 105 insertions, 142 deletions
diff --git a/src/window.c b/src/window.c index f1b19390cd0..03d08da042d 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -146,11 +146,16 @@ decode_window (register Lisp_Object window) | |||
| 146 | static struct window * | 146 | static struct window * |
| 147 | decode_any_window (register Lisp_Object window) | 147 | decode_any_window (register Lisp_Object window) |
| 148 | { | 148 | { |
| 149 | struct window *w; | ||
| 150 | |||
| 149 | if (NILP (window)) | 151 | if (NILP (window)) |
| 150 | return XWINDOW (selected_window); | 152 | return XWINDOW (selected_window); |
| 151 | 153 | ||
| 152 | CHECK_WINDOW (window); | 154 | CHECK_WINDOW (window); |
| 153 | return XWINDOW (window); | 155 | w = XWINDOW (window); |
| 156 | /* The following test throws up every time a tooltip frame is displayed. */ | ||
| 157 | /* CHECK_LIVE_FRAME (w->frame); */ | ||
| 158 | return w; | ||
| 154 | } | 159 | } |
| 155 | 160 | ||
| 156 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, | 161 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, |
| @@ -333,8 +338,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 333 | 338 | ||
| 334 | if (NILP (norecord)) | 339 | if (NILP (norecord)) |
| 335 | { | 340 | { |
| 336 | ++window_select_count; | 341 | w->use_time = ++window_select_count; |
| 337 | XSETFASTINT (w->use_time, window_select_count); | ||
| 338 | record_buffer (w->buffer); | 342 | record_buffer (w->buffer); |
| 339 | } | 343 | } |
| 340 | 344 | ||
| @@ -487,9 +491,7 @@ for future use. */) | |||
| 487 | (Lisp_Object window, Lisp_Object limit) | 491 | (Lisp_Object window, Lisp_Object limit) |
| 488 | { | 492 | { |
| 489 | register struct window *w = decode_any_window (window); | 493 | register struct window *w = decode_any_window (window); |
| 490 | |||
| 491 | w->combination_limit = limit; | 494 | w->combination_limit = limit; |
| 492 | |||
| 493 | return w->combination_limit; | 495 | return w->combination_limit; |
| 494 | } | 496 | } |
| 495 | 497 | ||
| @@ -501,7 +503,7 @@ one. The window with the lowest use time is the least recently | |||
| 501 | selected one. */) | 503 | selected one. */) |
| 502 | (Lisp_Object window) | 504 | (Lisp_Object window) |
| 503 | { | 505 | { |
| 504 | return decode_window (window)->use_time; | 506 | return make_number (decode_window (window)->use_time); |
| 505 | } | 507 | } |
| 506 | 508 | ||
| 507 | DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, | 509 | DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, |
| @@ -670,30 +672,45 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | |||
| 670 | WINDOW must be a live window and defaults to the selected one. */) | 672 | WINDOW must be a live window and defaults to the selected one. */) |
| 671 | (Lisp_Object window) | 673 | (Lisp_Object window) |
| 672 | { | 674 | { |
| 673 | return decode_window (window)->hscroll; | 675 | return make_number (decode_window (window)->hscroll); |
| 676 | } | ||
| 677 | |||
| 678 | /* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable | ||
| 679 | range, returning the new amount as a fixnum. */ | ||
| 680 | static Lisp_Object | ||
| 681 | set_window_hscroll (struct window *w, EMACS_INT hscroll) | ||
| 682 | { | ||
| 683 | /* Horizontal scrolling has problems with large scroll amounts. | ||
| 684 | It's too slow with long lines, and even with small lines the | ||
| 685 | display can be messed up. For now, though, impose only the limits | ||
| 686 | required by the internal representation: horizontal scrolling must | ||
| 687 | fit in fixnum (since it's visible to Elisp) and into ptrdiff_t | ||
| 688 | (since it's stored in a ptrdiff_t). */ | ||
| 689 | ptrdiff_t hscroll_max = min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX); | ||
| 690 | ptrdiff_t new_hscroll = clip_to_bounds (0, hscroll, hscroll_max); | ||
| 691 | |||
| 692 | /* Prevent redisplay shortcuts when changing the hscroll. */ | ||
| 693 | if (w->hscroll != new_hscroll) | ||
| 694 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | ||
| 695 | |||
| 696 | w->hscroll = new_hscroll; | ||
| 697 | return make_number (new_hscroll); | ||
| 674 | } | 698 | } |
| 675 | 699 | ||
| 676 | DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | 700 | DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, |
| 677 | doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. | 701 | doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. |
| 678 | If WINDOW is nil, the selected window is used. | 702 | If WINDOW is nil, the selected window is used. |
| 679 | Return NCOL. NCOL should be zero or positive. | 703 | Clip the number to a reasonable value if out of range. |
| 704 | Return the new number. NCOL should be zero or positive. | ||
| 680 | 705 | ||
| 681 | Note that if `automatic-hscrolling' is non-nil, you cannot scroll the | 706 | Note that if `automatic-hscrolling' is non-nil, you cannot scroll the |
| 682 | window so that the location of point moves off-window. */) | 707 | window so that the location of point moves off-window. */) |
| 683 | (Lisp_Object window, Lisp_Object ncol) | 708 | (Lisp_Object window, Lisp_Object ncol) |
| 684 | { | 709 | { |
| 685 | struct window *w = decode_window (window); | 710 | struct window *w = decode_window (window); |
| 686 | ptrdiff_t hscroll; | ||
| 687 | 711 | ||
| 688 | CHECK_NUMBER (ncol); | 712 | CHECK_NUMBER (ncol); |
| 689 | hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX); | 713 | return set_window_hscroll (w, XINT (ncol)); |
| 690 | |||
| 691 | /* Prevent redisplay shortcuts when changing the hscroll. */ | ||
| 692 | if (XINT (w->hscroll) != hscroll) | ||
| 693 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | ||
| 694 | |||
| 695 | w->hscroll = make_number (hscroll); | ||
| 696 | return ncol; | ||
| 697 | } | 714 | } |
| 698 | 715 | ||
| 699 | DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, | 716 | DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, |
| @@ -1316,8 +1333,8 @@ if it isn't already recorded. */) | |||
| 1316 | 1333 | ||
| 1317 | if (! NILP (update) | 1334 | if (! NILP (update) |
| 1318 | && ! (! NILP (w->window_end_valid) | 1335 | && ! (! NILP (w->window_end_valid) |
| 1319 | && XFASTINT (w->last_modified) >= BUF_MODIFF (b) | 1336 | && w->last_modified >= BUF_MODIFF (b) |
| 1320 | && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (b)) | 1337 | && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b)) |
| 1321 | && !noninteractive) | 1338 | && !noninteractive) |
| 1322 | { | 1339 | { |
| 1323 | struct text_pos startp; | 1340 | struct text_pos startp; |
| @@ -1400,8 +1417,8 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1400 | if (NILP (noforce)) | 1417 | if (NILP (noforce)) |
| 1401 | w->force_start = 1; | 1418 | w->force_start = 1; |
| 1402 | w->update_mode_line = 1; | 1419 | w->update_mode_line = 1; |
| 1403 | XSETFASTINT (w->last_modified, 0); | 1420 | w->last_modified = 0; |
| 1404 | XSETFASTINT (w->last_overlay_modified, 0); | 1421 | w->last_overlay_modified = 0; |
| 1405 | if (!EQ (window, selected_window)) | 1422 | if (!EQ (window, selected_window)) |
| 1406 | windows_or_buffers_changed++; | 1423 | windows_or_buffers_changed++; |
| 1407 | 1424 | ||
| @@ -1513,8 +1530,8 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1513 | if (NILP (w->window_end_valid) | 1530 | if (NILP (w->window_end_valid) |
| 1514 | || current_buffer->clip_changed | 1531 | || current_buffer->clip_changed |
| 1515 | || current_buffer->prevent_redisplay_optimizations_p | 1532 | || current_buffer->prevent_redisplay_optimizations_p |
| 1516 | || XFASTINT (w->last_modified) < BUF_MODIFF (b) | 1533 | || w->last_modified < BUF_MODIFF (b) |
| 1517 | || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) | 1534 | || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b)) |
| 1518 | return Qnil; | 1535 | return Qnil; |
| 1519 | 1536 | ||
| 1520 | if (NILP (line)) | 1537 | if (NILP (line)) |
| @@ -2037,7 +2054,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf | |||
| 2037 | candidate_p = 1; | 2054 | candidate_p = 1; |
| 2038 | else if (NILP (all_frames)) | 2055 | else if (NILP (all_frames)) |
| 2039 | { | 2056 | { |
| 2040 | xassert (WINDOWP (owindow)); | 2057 | eassert (WINDOWP (owindow)); |
| 2041 | candidate_p = EQ (w->frame, XWINDOW (owindow)->frame); | 2058 | candidate_p = EQ (w->frame, XWINDOW (owindow)->frame); |
| 2042 | } | 2059 | } |
| 2043 | else if (EQ (all_frames, Qvisible)) | 2060 | else if (EQ (all_frames, Qvisible)) |
| @@ -2876,13 +2893,6 @@ adjust_window_margins (struct window *w) | |||
| 2876 | return 1; | 2893 | return 1; |
| 2877 | } | 2894 | } |
| 2878 | 2895 | ||
| 2879 | static Lisp_Object Fset_window_margins (Lisp_Object, Lisp_Object, Lisp_Object); | ||
| 2880 | static Lisp_Object Fset_window_fringes (Lisp_Object, Lisp_Object, Lisp_Object, | ||
| 2881 | Lisp_Object); | ||
| 2882 | static Lisp_Object Fset_window_scroll_bars (Lisp_Object, Lisp_Object, | ||
| 2883 | Lisp_Object, Lisp_Object); | ||
| 2884 | static Lisp_Object Fset_window_vscroll (Lisp_Object, Lisp_Object, Lisp_Object); | ||
| 2885 | |||
| 2886 | /* The following three routines are needed for running a window's | 2896 | /* The following three routines are needed for running a window's |
| 2887 | configuration change hook. */ | 2897 | configuration change hook. */ |
| 2888 | static void | 2898 | static void |
| @@ -3005,7 +3015,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3005 | Resetting hscroll and vscroll here is problematic for things like | 3015 | Resetting hscroll and vscroll here is problematic for things like |
| 3006 | image-mode and doc-view-mode since it resets the image's position | 3016 | image-mode and doc-view-mode since it resets the image's position |
| 3007 | whenever we resize the frame. */ | 3017 | whenever we resize the frame. */ |
| 3008 | w->hscroll = w->min_hscroll = make_number (0); | 3018 | w->hscroll = w->min_hscroll = 0; |
| 3009 | w->vscroll = 0; | 3019 | w->vscroll = 0; |
| 3010 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); | 3020 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); |
| 3011 | set_marker_restricted (w->start, | 3021 | set_marker_restricted (w->start, |
| @@ -3013,8 +3023,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3013 | buffer); | 3023 | buffer); |
| 3014 | w->start_at_line_beg = 0; | 3024 | w->start_at_line_beg = 0; |
| 3015 | w->force_start = 0; | 3025 | w->force_start = 0; |
| 3016 | XSETFASTINT (w->last_modified, 0); | 3026 | w->last_modified = 0; |
| 3017 | XSETFASTINT (w->last_overlay_modified, 0); | 3027 | w->last_overlay_modified = 0; |
| 3018 | } | 3028 | } |
| 3019 | /* Maybe we could move this into the `if' but it's not obviously safe and | 3029 | /* Maybe we could move this into the `if' but it's not obviously safe and |
| 3020 | I doubt it's worth the trouble. */ | 3030 | I doubt it's worth the trouble. */ |
| @@ -3199,8 +3209,8 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3199 | Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); | 3209 | Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
| 3200 | Vminibuf_scroll_window = window; | 3210 | Vminibuf_scroll_window = window; |
| 3201 | w = XWINDOW (window); | 3211 | w = XWINDOW (window); |
| 3202 | XSETFASTINT (w->hscroll, 0); | 3212 | w->hscroll = 0; |
| 3203 | XSETFASTINT (w->min_hscroll, 0); | 3213 | w->min_hscroll = 0; |
| 3204 | set_marker_restricted_both (w->start, buf, BEG, BEG); | 3214 | set_marker_restricted_both (w->start, buf, BEG, BEG); |
| 3205 | set_marker_restricted_both (w->pointm, buf, BEG, BEG); | 3215 | set_marker_restricted_both (w->pointm, buf, BEG, BEG); |
| 3206 | 3216 | ||
| @@ -3244,17 +3254,15 @@ make_parent_window (Lisp_Object window, int horflag) | |||
| 3244 | { | 3254 | { |
| 3245 | Lisp_Object parent; | 3255 | Lisp_Object parent; |
| 3246 | register struct window *o, *p; | 3256 | register struct window *o, *p; |
| 3247 | int i; | ||
| 3248 | 3257 | ||
| 3249 | o = XWINDOW (window); | 3258 | o = XWINDOW (window); |
| 3250 | p = allocate_window (); | 3259 | p = allocate_window (); |
| 3251 | for (i = 0; i < VECSIZE (struct window); ++i) | 3260 | memcpy ((char *) p + sizeof (struct vectorlike_header), |
| 3252 | ((struct Lisp_Vector *) p)->contents[i] | 3261 | (char *) o + sizeof (struct vectorlike_header), |
| 3253 | = ((struct Lisp_Vector *) o)->contents[i]; | 3262 | sizeof (Lisp_Object) * VECSIZE (struct window)); |
| 3254 | XSETWINDOW (parent, p); | 3263 | XSETWINDOW (parent, p); |
| 3255 | 3264 | ||
| 3256 | ++sequence_number; | 3265 | p->sequence_number = ++sequence_number; |
| 3257 | XSETFASTINT (p->sequence_number, sequence_number); | ||
| 3258 | 3266 | ||
| 3259 | replace_window (window, parent, 1); | 3267 | replace_window (window, parent, 1); |
| 3260 | 3268 | ||
| @@ -3279,10 +3287,8 @@ make_window (void) | |||
| 3279 | register struct window *w; | 3287 | register struct window *w; |
| 3280 | 3288 | ||
| 3281 | w = allocate_window (); | 3289 | w = allocate_window (); |
| 3282 | /* Initialize all Lisp data. */ | 3290 | /* Initialize Lisp data. Note that allocate_window initializes all |
| 3283 | w->frame = Qnil; | 3291 | Lisp data to nil, so do it only for slots which should not be nil. */ |
| 3284 | w->mini = 0; | ||
| 3285 | w->next = w->prev = w->hchild = w->vchild = w->parent = Qnil; | ||
| 3286 | XSETFASTINT (w->left_col, 0); | 3292 | XSETFASTINT (w->left_col, 0); |
| 3287 | XSETFASTINT (w->top_line, 0); | 3293 | XSETFASTINT (w->top_line, 0); |
| 3288 | XSETFASTINT (w->total_lines, 0); | 3294 | XSETFASTINT (w->total_lines, 0); |
| @@ -3291,47 +3297,19 @@ make_window (void) | |||
| 3291 | w->normal_cols = make_float (1.0); | 3297 | w->normal_cols = make_float (1.0); |
| 3292 | XSETFASTINT (w->new_total, 0); | 3298 | XSETFASTINT (w->new_total, 0); |
| 3293 | XSETFASTINT (w->new_normal, 0); | 3299 | XSETFASTINT (w->new_normal, 0); |
| 3294 | w->buffer = Qnil; | ||
| 3295 | w->start = Fmake_marker (); | 3300 | w->start = Fmake_marker (); |
| 3296 | w->pointm = Fmake_marker (); | 3301 | w->pointm = Fmake_marker (); |
| 3297 | w->force_start = w->optional_new_start = 0; | ||
| 3298 | XSETFASTINT (w->hscroll, 0); | ||
| 3299 | XSETFASTINT (w->min_hscroll, 0); | ||
| 3300 | XSETFASTINT (w->use_time, 0); | ||
| 3301 | ++sequence_number; | ||
| 3302 | XSETFASTINT (w->sequence_number, sequence_number); | ||
| 3303 | w->temslot = w->last_modified = w->last_overlay_modified = Qnil; | ||
| 3304 | XSETFASTINT (w->last_point, 0); | ||
| 3305 | w->last_had_star = 0; | ||
| 3306 | w->vertical_scroll_bar = Qnil; | ||
| 3307 | w->left_margin_cols = w->right_margin_cols = Qnil; | ||
| 3308 | w->left_fringe_width = w->right_fringe_width = Qnil; | ||
| 3309 | w->fringes_outside_margins = Qnil; | ||
| 3310 | w->scroll_bar_width = Qnil; | ||
| 3311 | w->vertical_scroll_bar_type = Qt; | 3302 | w->vertical_scroll_bar_type = Qt; |
| 3312 | XSETFASTINT (w->window_end_pos, 0); | 3303 | XSETFASTINT (w->window_end_pos, 0); |
| 3313 | XSETFASTINT (w->window_end_vpos, 0); | 3304 | XSETFASTINT (w->window_end_vpos, 0); |
| 3314 | w->window_end_valid = w->display_table = Qnil; | 3305 | |
| 3315 | w->update_mode_line = w->start_at_line_beg = 0; | 3306 | /* Initialize non-Lisp data. Note that allocate_window zeroes out all |
| 3316 | w->dedicated = Qnil; | 3307 | non-Lisp data, so do it only for slots which should not be zero. */ |
| 3317 | w->base_line_number = w->base_line_pos = w->region_showing = Qnil; | ||
| 3318 | w->column_number_displayed = w->redisplay_end_trigger = Qnil; | ||
| 3319 | w->combination_limit = w->window_parameters = Qnil; | ||
| 3320 | w->prev_buffers = w->next_buffers = Qnil; | ||
| 3321 | /* Initialize non-Lisp data. */ | ||
| 3322 | w->desired_matrix = w->current_matrix = 0; | ||
| 3323 | w->nrows_scale_factor = w->ncols_scale_factor = 1; | 3308 | w->nrows_scale_factor = w->ncols_scale_factor = 1; |
| 3324 | memset (&w->cursor, 0, sizeof (w->cursor)); | ||
| 3325 | memset (&w->last_cursor, 0, sizeof (w->last_cursor)); | ||
| 3326 | memset (&w->phys_cursor, 0, sizeof (w->phys_cursor)); | ||
| 3327 | w->phys_cursor_type = -1; | 3309 | w->phys_cursor_type = -1; |
| 3328 | w->phys_cursor_width = -1; | 3310 | w->phys_cursor_width = -1; |
| 3329 | w->phys_cursor_on_p = 0; | 3311 | w->sequence_number = ++sequence_number; |
| 3330 | w->last_cursor_off_p = w->cursor_off_p = 0; | 3312 | |
| 3331 | w->must_be_updated_p = 0; | ||
| 3332 | w->pseudo_window_p = 0; | ||
| 3333 | w->frozen_window_start_p = 0; | ||
| 3334 | w->vscroll = 0; | ||
| 3335 | /* Reset window_list. */ | 3313 | /* Reset window_list. */ |
| 3336 | Vwindow_list = Qnil; | 3314 | Vwindow_list = Qnil; |
| 3337 | /* Return window. */ | 3315 | /* Return window. */ |
| @@ -3520,8 +3498,8 @@ window_resize_apply (struct window *w, int horflag) | |||
| 3520 | } | 3498 | } |
| 3521 | 3499 | ||
| 3522 | /* Clear out some redisplay caches. */ | 3500 | /* Clear out some redisplay caches. */ |
| 3523 | XSETFASTINT (w->last_modified, 0); | 3501 | w->last_modified = 0; |
| 3524 | XSETFASTINT (w->last_overlay_modified, 0); | 3502 | w->last_overlay_modified = 0; |
| 3525 | } | 3503 | } |
| 3526 | 3504 | ||
| 3527 | 3505 | ||
| @@ -4041,8 +4019,8 @@ grow_mini_window (struct window *w, int delta) | |||
| 4041 | struct window *r; | 4019 | struct window *r; |
| 4042 | Lisp_Object root, value; | 4020 | Lisp_Object root, value; |
| 4043 | 4021 | ||
| 4044 | xassert (MINI_WINDOW_P (w)); | 4022 | eassert (MINI_WINDOW_P (w)); |
| 4045 | xassert (delta >= 0); | 4023 | eassert (delta >= 0); |
| 4046 | 4024 | ||
| 4047 | root = FRAME_ROOT_WINDOW (f); | 4025 | root = FRAME_ROOT_WINDOW (f); |
| 4048 | r = XWINDOW (root); | 4026 | r = XWINDOW (root); |
| @@ -4056,8 +4034,8 @@ grow_mini_window (struct window *w, int delta) | |||
| 4056 | /* Grow the mini-window. */ | 4034 | /* Grow the mini-window. */ |
| 4057 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); | 4035 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); |
| 4058 | XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); | 4036 | XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); |
| 4059 | XSETFASTINT (w->last_modified, 0); | 4037 | w->last_modified = 0; |
| 4060 | XSETFASTINT (w->last_overlay_modified, 0); | 4038 | w->last_overlay_modified = 0; |
| 4061 | 4039 | ||
| 4062 | adjust_glyphs (f); | 4040 | adjust_glyphs (f); |
| 4063 | UNBLOCK_INPUT; | 4041 | UNBLOCK_INPUT; |
| @@ -4074,7 +4052,7 @@ shrink_mini_window (struct window *w) | |||
| 4074 | Lisp_Object root, value; | 4052 | Lisp_Object root, value; |
| 4075 | EMACS_INT size; | 4053 | EMACS_INT size; |
| 4076 | 4054 | ||
| 4077 | xassert (MINI_WINDOW_P (w)); | 4055 | eassert (MINI_WINDOW_P (w)); |
| 4078 | 4056 | ||
| 4079 | size = XINT (w->total_lines); | 4057 | size = XINT (w->total_lines); |
| 4080 | if (size > 1) | 4058 | if (size > 1) |
| @@ -4092,8 +4070,8 @@ shrink_mini_window (struct window *w) | |||
| 4092 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); | 4070 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); |
| 4093 | XSETFASTINT (w->total_lines, 1); | 4071 | XSETFASTINT (w->total_lines, 1); |
| 4094 | 4072 | ||
| 4095 | XSETFASTINT (w->last_modified, 0); | 4073 | w->last_modified = 0; |
| 4096 | XSETFASTINT (w->last_overlay_modified, 0); | 4074 | w->last_overlay_modified = 0; |
| 4097 | 4075 | ||
| 4098 | adjust_glyphs (f); | 4076 | adjust_glyphs (f); |
| 4099 | UNBLOCK_INPUT; | 4077 | UNBLOCK_INPUT; |
| @@ -4320,8 +4298,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4320 | w->buffer); | 4298 | w->buffer); |
| 4321 | w->start_at_line_beg = 1; | 4299 | w->start_at_line_beg = 1; |
| 4322 | w->update_mode_line = 1; | 4300 | w->update_mode_line = 1; |
| 4323 | XSETFASTINT (w->last_modified, 0); | 4301 | w->last_modified = 0; |
| 4324 | XSETFASTINT (w->last_overlay_modified, 0); | 4302 | w->last_overlay_modified = 0; |
| 4325 | /* Set force_start so that redisplay_window will run the | 4303 | /* Set force_start so that redisplay_window will run the |
| 4326 | window-scroll-functions. */ | 4304 | window-scroll-functions. */ |
| 4327 | w->force_start = 1; | 4305 | w->force_start = 1; |
| @@ -4466,8 +4444,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4466 | bytepos = XMARKER (w->start)->bytepos; | 4444 | bytepos = XMARKER (w->start)->bytepos; |
| 4467 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); | 4445 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); |
| 4468 | w->update_mode_line = 1; | 4446 | w->update_mode_line = 1; |
| 4469 | XSETFASTINT (w->last_modified, 0); | 4447 | w->last_modified = 0; |
| 4470 | XSETFASTINT (w->last_overlay_modified, 0); | 4448 | w->last_overlay_modified = 0; |
| 4471 | /* Set force_start so that redisplay_window will run the | 4449 | /* Set force_start so that redisplay_window will run the |
| 4472 | window-scroll-functions. */ | 4450 | window-scroll-functions. */ |
| 4473 | w->force_start = 1; | 4451 | w->force_start = 1; |
| @@ -4620,10 +4598,10 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4620 | struct position posit | 4598 | struct position posit |
| 4621 | = *compute_motion (startpos, 0, 0, 0, | 4599 | = *compute_motion (startpos, 0, 0, 0, |
| 4622 | PT, ht, 0, | 4600 | PT, ht, 0, |
| 4623 | -1, XINT (w->hscroll), | 4601 | -1, w->hscroll, |
| 4624 | 0, w); | 4602 | 0, w); |
| 4625 | window_scroll_preserve_vpos = posit.vpos; | 4603 | window_scroll_preserve_vpos = posit.vpos; |
| 4626 | window_scroll_preserve_hpos = posit.hpos + XINT (w->hscroll); | 4604 | window_scroll_preserve_hpos = posit.hpos + w->hscroll; |
| 4627 | } | 4605 | } |
| 4628 | 4606 | ||
| 4629 | original_pos = Fcons (make_number (window_scroll_preserve_hpos), | 4607 | original_pos = Fcons (make_number (window_scroll_preserve_hpos), |
| @@ -4665,8 +4643,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4665 | set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); | 4643 | set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); |
| 4666 | w->start_at_line_beg = !NILP (bolp); | 4644 | w->start_at_line_beg = !NILP (bolp); |
| 4667 | w->update_mode_line = 1; | 4645 | w->update_mode_line = 1; |
| 4668 | XSETFASTINT (w->last_modified, 0); | 4646 | w->last_modified = 0; |
| 4669 | XSETFASTINT (w->last_overlay_modified, 0); | 4647 | w->last_overlay_modified = 0; |
| 4670 | /* Set force_start so that redisplay_window will run | 4648 | /* Set force_start so that redisplay_window will run |
| 4671 | the window-scroll-functions. */ | 4649 | the window-scroll-functions. */ |
| 4672 | w->force_start = 1; | 4650 | w->force_start = 1; |
| @@ -4752,7 +4730,7 @@ scroll_command (Lisp_Object n, int direction) | |||
| 4752 | { | 4730 | { |
| 4753 | ptrdiff_t count = SPECPDL_INDEX (); | 4731 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4754 | 4732 | ||
| 4755 | xassert (eabs (direction) == 1); | 4733 | eassert (eabs (direction) == 1); |
| 4756 | 4734 | ||
| 4757 | /* If selected window's buffer isn't current, make it current for | 4735 | /* If selected window's buffer isn't current, make it current for |
| 4758 | the moment. But don't screw up if window_scroll gets an error. */ | 4736 | the moment. But don't screw up if window_scroll gets an error. */ |
| @@ -4884,7 +4862,7 @@ specifies the window to scroll. This takes precedence over | |||
| 4884 | else | 4862 | else |
| 4885 | { | 4863 | { |
| 4886 | if (CONSP (arg)) | 4864 | if (CONSP (arg)) |
| 4887 | arg = Fcar (arg); | 4865 | arg = XCAR (arg); |
| 4888 | CHECK_NUMBER (arg); | 4866 | CHECK_NUMBER (arg); |
| 4889 | window_scroll (window, XINT (arg), 0, 1); | 4867 | window_scroll (window, XINT (arg), 0, 1); |
| 4890 | } | 4868 | } |
| @@ -4906,17 +4884,11 @@ will not scroll a window to a column less than the value returned | |||
| 4906 | by this function. This happens in an interactive call. */) | 4884 | by this function. This happens in an interactive call. */) |
| 4907 | (register Lisp_Object arg, Lisp_Object set_minimum) | 4885 | (register Lisp_Object arg, Lisp_Object set_minimum) |
| 4908 | { | 4886 | { |
| 4909 | Lisp_Object result; | ||
| 4910 | EMACS_INT hscroll; | ||
| 4911 | struct window *w = XWINDOW (selected_window); | 4887 | struct window *w = XWINDOW (selected_window); |
| 4912 | 4888 | EMACS_INT requested_arg = (NILP (arg) | |
| 4913 | if (NILP (arg)) | 4889 | ? window_body_cols (w) - 2 |
| 4914 | XSETFASTINT (arg, window_body_cols (w) - 2); | 4890 | : XINT (Fprefix_numeric_value (arg))); |
| 4915 | else | 4891 | Lisp_Object result = set_window_hscroll (w, w->hscroll + requested_arg); |
| 4916 | arg = Fprefix_numeric_value (arg); | ||
| 4917 | |||
| 4918 | hscroll = XINT (w->hscroll) + XINT (arg); | ||
| 4919 | result = Fset_window_hscroll (selected_window, make_number (hscroll)); | ||
| 4920 | 4892 | ||
| 4921 | if (!NILP (set_minimum)) | 4893 | if (!NILP (set_minimum)) |
| 4922 | w->min_hscroll = w->hscroll; | 4894 | w->min_hscroll = w->hscroll; |
| @@ -4935,17 +4907,11 @@ will not scroll a window to a column less than the value returned | |||
| 4935 | by this function. This happens in an interactive call. */) | 4907 | by this function. This happens in an interactive call. */) |
| 4936 | (register Lisp_Object arg, Lisp_Object set_minimum) | 4908 | (register Lisp_Object arg, Lisp_Object set_minimum) |
| 4937 | { | 4909 | { |
| 4938 | Lisp_Object result; | ||
| 4939 | EMACS_INT hscroll; | ||
| 4940 | struct window *w = XWINDOW (selected_window); | 4910 | struct window *w = XWINDOW (selected_window); |
| 4941 | 4911 | EMACS_INT requested_arg = (NILP (arg) | |
| 4942 | if (NILP (arg)) | 4912 | ? window_body_cols (w) - 2 |
| 4943 | XSETFASTINT (arg, window_body_cols (w) - 2); | 4913 | : XINT (Fprefix_numeric_value (arg))); |
| 4944 | else | 4914 | Lisp_Object result = set_window_hscroll (w, w->hscroll - requested_arg); |
| 4945 | arg = Fprefix_numeric_value (arg); | ||
| 4946 | |||
| 4947 | hscroll = XINT (w->hscroll) - XINT (arg); | ||
| 4948 | result = Fset_window_hscroll (selected_window, make_number (hscroll)); | ||
| 4949 | 4915 | ||
| 4950 | if (!NILP (set_minimum)) | 4916 | if (!NILP (set_minimum)) |
| 4951 | w->min_hscroll = w->hscroll; | 4917 | w->min_hscroll = w->hscroll; |
| @@ -5511,9 +5477,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5511 | really like to do is to free only those matrices not reused | 5477 | really like to do is to free only those matrices not reused |
| 5512 | below. */ | 5478 | below. */ |
| 5513 | root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); | 5479 | root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 5514 | leaf_windows | 5480 | leaf_windows = alloca (count_windows (root_window) |
| 5515 | = (struct window **) alloca (count_windows (root_window) | 5481 | * sizeof *leaf_windows); |
| 5516 | * sizeof (struct window *)); | ||
| 5517 | n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0); | 5482 | n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0); |
| 5518 | 5483 | ||
| 5519 | /* Kludge Alert! | 5484 | /* Kludge Alert! |
| @@ -5572,14 +5537,14 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5572 | w->total_lines = p->total_lines; | 5537 | w->total_lines = p->total_lines; |
| 5573 | w->normal_cols = p->normal_cols; | 5538 | w->normal_cols = p->normal_cols; |
| 5574 | w->normal_lines = p->normal_lines; | 5539 | w->normal_lines = p->normal_lines; |
| 5575 | w->hscroll = p->hscroll; | 5540 | w->hscroll = XFASTINT (p->hscroll); |
| 5576 | w->min_hscroll = p->min_hscroll; | 5541 | w->min_hscroll = XFASTINT (p->min_hscroll); |
| 5577 | w->display_table = p->display_table; | 5542 | w->display_table = p->display_table; |
| 5578 | w->left_margin_cols = p->left_margin_cols; | 5543 | w->left_margin_cols = p->left_margin_cols; |
| 5579 | w->right_margin_cols = p->right_margin_cols; | 5544 | w->right_margin_cols = p->right_margin_cols; |
| 5580 | w->left_fringe_width = p->left_fringe_width; | 5545 | w->left_fringe_width = p->left_fringe_width; |
| 5581 | w->right_fringe_width = p->right_fringe_width; | 5546 | w->right_fringe_width = p->right_fringe_width; |
| 5582 | w->fringes_outside_margins = p->fringes_outside_margins; | 5547 | w->fringes_outside_margins = !NILP (p->fringes_outside_margins); |
| 5583 | w->scroll_bar_width = p->scroll_bar_width; | 5548 | w->scroll_bar_width = p->scroll_bar_width; |
| 5584 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; | 5549 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; |
| 5585 | w->dedicated = p->dedicated; | 5550 | w->dedicated = p->dedicated; |
| @@ -5606,8 +5571,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5606 | } | 5571 | } |
| 5607 | } | 5572 | } |
| 5608 | 5573 | ||
| 5609 | XSETFASTINT (w->last_modified, 0); | 5574 | w->last_modified = 0; |
| 5610 | XSETFASTINT (w->last_overlay_modified, 0); | 5575 | w->last_overlay_modified = 0; |
| 5611 | 5576 | ||
| 5612 | /* Reinstall the saved buffer and pointers into it. */ | 5577 | /* Reinstall the saved buffer and pointers into it. */ |
| 5613 | if (NILP (p->buffer)) | 5578 | if (NILP (p->buffer)) |
| @@ -5717,7 +5682,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5717 | if (NILP (leaf_windows[i]->buffer)) | 5682 | if (NILP (leaf_windows[i]->buffer)) |
| 5718 | { | 5683 | { |
| 5719 | /* Assert it's not reused as a combination. */ | 5684 | /* Assert it's not reused as a combination. */ |
| 5720 | xassert (NILP (leaf_windows[i]->hchild) | 5685 | eassert (NILP (leaf_windows[i]->hchild) |
| 5721 | && NILP (leaf_windows[i]->vchild)); | 5686 | && NILP (leaf_windows[i]->vchild)); |
| 5722 | free_window_matrices (leaf_windows[i]); | 5687 | free_window_matrices (leaf_windows[i]); |
| 5723 | } | 5688 | } |
| @@ -5846,7 +5811,7 @@ get_phys_cursor_glyph (struct window *w) | |||
| 5846 | if (!row->enabled_p) | 5811 | if (!row->enabled_p) |
| 5847 | return NULL; | 5812 | return NULL; |
| 5848 | 5813 | ||
| 5849 | if (XINT (w->hscroll)) | 5814 | if (w->hscroll) |
| 5850 | { | 5815 | { |
| 5851 | /* When the window is hscrolled, cursor hpos can legitimately be | 5816 | /* When the window is hscrolled, cursor hpos can legitimately be |
| 5852 | out of bounds, but we draw the cursor at the corresponding | 5817 | out of bounds, but we draw the cursor at the corresponding |
| @@ -5888,14 +5853,14 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 5888 | p->total_lines = w->total_lines; | 5853 | p->total_lines = w->total_lines; |
| 5889 | p->normal_cols = w->normal_cols; | 5854 | p->normal_cols = w->normal_cols; |
| 5890 | p->normal_lines = w->normal_lines; | 5855 | p->normal_lines = w->normal_lines; |
| 5891 | p->hscroll = w->hscroll; | 5856 | XSETFASTINT (p->hscroll, w->hscroll); |
| 5892 | p->min_hscroll = w->min_hscroll; | 5857 | XSETFASTINT (p->min_hscroll, w->min_hscroll); |
| 5893 | p->display_table = w->display_table; | 5858 | p->display_table = w->display_table; |
| 5894 | p->left_margin_cols = w->left_margin_cols; | 5859 | p->left_margin_cols = w->left_margin_cols; |
| 5895 | p->right_margin_cols = w->right_margin_cols; | 5860 | p->right_margin_cols = w->right_margin_cols; |
| 5896 | p->left_fringe_width = w->left_fringe_width; | 5861 | p->left_fringe_width = w->left_fringe_width; |
| 5897 | p->right_fringe_width = w->right_fringe_width; | 5862 | p->right_fringe_width = w->right_fringe_width; |
| 5898 | p->fringes_outside_margins = w->fringes_outside_margins; | 5863 | p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil; |
| 5899 | p->scroll_bar_width = w->scroll_bar_width; | 5864 | p->scroll_bar_width = w->scroll_bar_width; |
| 5900 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; | 5865 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; |
| 5901 | p->dedicated = w->dedicated; | 5866 | p->dedicated = w->dedicated; |
| @@ -5954,12 +5919,9 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 5954 | is the selected window, then get the value of point from | 5919 | is the selected window, then get the value of point from |
| 5955 | the buffer; pointm is garbage in the selected window. */ | 5920 | the buffer; pointm is garbage in the selected window. */ |
| 5956 | if (EQ (window, selected_window)) | 5921 | if (EQ (window, selected_window)) |
| 5957 | { | 5922 | p->pointm = build_marker (XBUFFER (w->buffer), |
| 5958 | p->pointm = Fmake_marker (); | 5923 | BUF_PT (XBUFFER (w->buffer)), |
| 5959 | set_marker_both (p->pointm, w->buffer, | 5924 | BUF_PT_BYTE (XBUFFER (w->buffer))); |
| 5960 | BUF_PT (XBUFFER (w->buffer)), | ||
| 5961 | BUF_PT_BYTE (XBUFFER (w->buffer))); | ||
| 5962 | } | ||
| 5963 | else | 5925 | else |
| 5964 | p->pointm = Fcopy_marker (w->pointm, Qnil); | 5926 | p->pointm = Fcopy_marker (w->pointm, Qnil); |
| 5965 | XMARKER (p->pointm)->insertion_type | 5927 | XMARKER (p->pointm)->insertion_type |
| @@ -6041,8 +6003,8 @@ saved by this function. */) | |||
| 6041 | tem = Fmake_vector (make_number (n_windows), Qnil); | 6003 | tem = Fmake_vector (make_number (n_windows), Qnil); |
| 6042 | data->saved_windows = tem; | 6004 | data->saved_windows = tem; |
| 6043 | for (i = 0; i < n_windows; i++) | 6005 | for (i = 0; i < n_windows; i++) |
| 6044 | XVECTOR (tem)->contents[i] | 6006 | ASET (tem, i, |
| 6045 | = Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil); | 6007 | Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil)); |
| 6046 | save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0); | 6008 | save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0); |
| 6047 | XSETWINDOW_CONFIGURATION (tem, data); | 6009 | XSETWINDOW_CONFIGURATION (tem, data); |
| 6048 | return (tem); | 6010 | return (tem); |
| @@ -6132,6 +6094,7 @@ display marginal areas and the text area. */) | |||
| 6132 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) | 6094 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) |
| 6133 | { | 6095 | { |
| 6134 | struct window *w = decode_window (window); | 6096 | struct window *w = decode_window (window); |
| 6097 | int outside = !NILP (outside_margins); | ||
| 6135 | 6098 | ||
| 6136 | if (!NILP (left_width)) | 6099 | if (!NILP (left_width)) |
| 6137 | CHECK_NATNUM (left_width); | 6100 | CHECK_NATNUM (left_width); |
| @@ -6142,11 +6105,11 @@ display marginal areas and the text area. */) | |||
| 6142 | if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) | 6105 | if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) |
| 6143 | && (!EQ (w->left_fringe_width, left_width) | 6106 | && (!EQ (w->left_fringe_width, left_width) |
| 6144 | || !EQ (w->right_fringe_width, right_width) | 6107 | || !EQ (w->right_fringe_width, right_width) |
| 6145 | || !EQ (w->fringes_outside_margins, outside_margins))) | 6108 | || w->fringes_outside_margins != outside)) |
| 6146 | { | 6109 | { |
| 6147 | w->left_fringe_width = left_width; | 6110 | w->left_fringe_width = left_width; |
| 6148 | w->right_fringe_width = right_width; | 6111 | w->right_fringe_width = right_width; |
| 6149 | w->fringes_outside_margins = outside_margins; | 6112 | w->fringes_outside_margins = outside; |
| 6150 | 6113 | ||
| 6151 | adjust_window_margins (w); | 6114 | adjust_window_margins (w); |
| 6152 | 6115 | ||
| @@ -6199,7 +6162,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */) | |||
| 6199 | 6162 | ||
| 6200 | if (!NILP (width)) | 6163 | if (!NILP (width)) |
| 6201 | { | 6164 | { |
| 6202 | CHECK_RANGED_INTEGER (0, width, INT_MAX); | 6165 | CHECK_RANGED_INTEGER (width, 0, INT_MAX); |
| 6203 | 6166 | ||
| 6204 | if (XINT (width) == 0) | 6167 | if (XINT (width) == 0) |
| 6205 | vertical_type = Qnil; | 6168 | vertical_type = Qnil; |