diff options
| author | Dmitry Antipov | 2012-06-28 16:29:37 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-06-28 16:29:37 +0400 |
| commit | 80b00b0885b8e124a208dfc9de95d2039a101108 (patch) | |
| tree | 8954c62ff23338f8a2c6063cccab6d40d8707e02 /src/window.c | |
| parent | 62b2bcf611f144f4dea5a073a362e187970609f6 (diff) | |
| download | emacs-80b00b0885b8e124a208dfc9de95d2039a101108.tar.gz emacs-80b00b0885b8e124a208dfc9de95d2039a101108.zip | |
* window.h (struct window): Change type of 'hscroll',
'min_hscroll' and 'last_point' from Lisp_Object to ptrdiff_t,
'last_modified' and 'last_overlay_modified' to EMACS_INT.
Adjust users accordingly.
* xdisp.c (try_cursor_movement): Replace type check with eassert.
* window.c (Fscroll_left, Fscroll_right): Change type of 'hscroll'
from EMACS_INT to ptrdiff_t.
(make_window): Omit redundant initialization.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/src/window.c b/src/window.c index 55d6ac7a6ee..4f3d40c51e3 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -667,7 +667,7 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | |||
| 667 | WINDOW must be a live window and defaults to the selected one. */) | 667 | WINDOW must be a live window and defaults to the selected one. */) |
| 668 | (Lisp_Object window) | 668 | (Lisp_Object window) |
| 669 | { | 669 | { |
| 670 | return decode_window (window)->hscroll; | 670 | return make_number (decode_window (window)->hscroll); |
| 671 | } | 671 | } |
| 672 | 672 | ||
| 673 | DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | 673 | DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, |
| @@ -686,10 +686,10 @@ window so that the location of point moves off-window. */) | |||
| 686 | hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX); | 686 | hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX); |
| 687 | 687 | ||
| 688 | /* Prevent redisplay shortcuts when changing the hscroll. */ | 688 | /* Prevent redisplay shortcuts when changing the hscroll. */ |
| 689 | if (XINT (w->hscroll) != hscroll) | 689 | if (w->hscroll != hscroll) |
| 690 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 690 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
| 691 | 691 | ||
| 692 | w->hscroll = make_number (hscroll); | 692 | w->hscroll = hscroll; |
| 693 | return ncol; | 693 | return ncol; |
| 694 | } | 694 | } |
| 695 | 695 | ||
| @@ -1313,8 +1313,8 @@ if it isn't already recorded. */) | |||
| 1313 | 1313 | ||
| 1314 | if (! NILP (update) | 1314 | if (! NILP (update) |
| 1315 | && ! (! NILP (w->window_end_valid) | 1315 | && ! (! NILP (w->window_end_valid) |
| 1316 | && XFASTINT (w->last_modified) >= BUF_MODIFF (b) | 1316 | && w->last_modified >= BUF_MODIFF (b) |
| 1317 | && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (b)) | 1317 | && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b)) |
| 1318 | && !noninteractive) | 1318 | && !noninteractive) |
| 1319 | { | 1319 | { |
| 1320 | struct text_pos startp; | 1320 | struct text_pos startp; |
| @@ -1397,8 +1397,8 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1397 | if (NILP (noforce)) | 1397 | if (NILP (noforce)) |
| 1398 | w->force_start = 1; | 1398 | w->force_start = 1; |
| 1399 | w->update_mode_line = 1; | 1399 | w->update_mode_line = 1; |
| 1400 | XSETFASTINT (w->last_modified, 0); | 1400 | w->last_modified = 0; |
| 1401 | XSETFASTINT (w->last_overlay_modified, 0); | 1401 | w->last_overlay_modified = 0; |
| 1402 | if (!EQ (window, selected_window)) | 1402 | if (!EQ (window, selected_window)) |
| 1403 | windows_or_buffers_changed++; | 1403 | windows_or_buffers_changed++; |
| 1404 | 1404 | ||
| @@ -1510,8 +1510,8 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1510 | if (NILP (w->window_end_valid) | 1510 | if (NILP (w->window_end_valid) |
| 1511 | || current_buffer->clip_changed | 1511 | || current_buffer->clip_changed |
| 1512 | || current_buffer->prevent_redisplay_optimizations_p | 1512 | || current_buffer->prevent_redisplay_optimizations_p |
| 1513 | || XFASTINT (w->last_modified) < BUF_MODIFF (b) | 1513 | || w->last_modified < BUF_MODIFF (b) |
| 1514 | || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) | 1514 | || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b)) |
| 1515 | return Qnil; | 1515 | return Qnil; |
| 1516 | 1516 | ||
| 1517 | if (NILP (line)) | 1517 | if (NILP (line)) |
| @@ -3002,7 +3002,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3002 | Resetting hscroll and vscroll here is problematic for things like | 3002 | Resetting hscroll and vscroll here is problematic for things like |
| 3003 | image-mode and doc-view-mode since it resets the image's position | 3003 | image-mode and doc-view-mode since it resets the image's position |
| 3004 | whenever we resize the frame. */ | 3004 | whenever we resize the frame. */ |
| 3005 | w->hscroll = w->min_hscroll = make_number (0); | 3005 | w->hscroll = w->min_hscroll = 0; |
| 3006 | w->vscroll = 0; | 3006 | w->vscroll = 0; |
| 3007 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); | 3007 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); |
| 3008 | set_marker_restricted (w->start, | 3008 | set_marker_restricted (w->start, |
| @@ -3010,8 +3010,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3010 | buffer); | 3010 | buffer); |
| 3011 | w->start_at_line_beg = 0; | 3011 | w->start_at_line_beg = 0; |
| 3012 | w->force_start = 0; | 3012 | w->force_start = 0; |
| 3013 | XSETFASTINT (w->last_modified, 0); | 3013 | w->last_modified = 0; |
| 3014 | XSETFASTINT (w->last_overlay_modified, 0); | 3014 | w->last_overlay_modified = 0; |
| 3015 | } | 3015 | } |
| 3016 | /* Maybe we could move this into the `if' but it's not obviously safe and | 3016 | /* Maybe we could move this into the `if' but it's not obviously safe and |
| 3017 | I doubt it's worth the trouble. */ | 3017 | I doubt it's worth the trouble. */ |
| @@ -3196,8 +3196,8 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3196 | Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); | 3196 | Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
| 3197 | Vminibuf_scroll_window = window; | 3197 | Vminibuf_scroll_window = window; |
| 3198 | w = XWINDOW (window); | 3198 | w = XWINDOW (window); |
| 3199 | XSETFASTINT (w->hscroll, 0); | 3199 | w->hscroll = 0; |
| 3200 | XSETFASTINT (w->min_hscroll, 0); | 3200 | w->min_hscroll = 0; |
| 3201 | set_marker_restricted_both (w->start, buf, BEG, BEG); | 3201 | set_marker_restricted_both (w->start, buf, BEG, BEG); |
| 3202 | set_marker_restricted_both (w->pointm, buf, BEG, BEG); | 3202 | set_marker_restricted_both (w->pointm, buf, BEG, BEG); |
| 3203 | 3203 | ||
| @@ -3286,9 +3286,6 @@ make_window (void) | |||
| 3286 | XSETFASTINT (w->new_normal, 0); | 3286 | XSETFASTINT (w->new_normal, 0); |
| 3287 | w->start = Fmake_marker (); | 3287 | w->start = Fmake_marker (); |
| 3288 | w->pointm = Fmake_marker (); | 3288 | w->pointm = Fmake_marker (); |
| 3289 | XSETFASTINT (w->hscroll, 0); | ||
| 3290 | XSETFASTINT (w->min_hscroll, 0); | ||
| 3291 | XSETFASTINT (w->last_point, 0); | ||
| 3292 | w->vertical_scroll_bar_type = Qt; | 3289 | w->vertical_scroll_bar_type = Qt; |
| 3293 | XSETFASTINT (w->window_end_pos, 0); | 3290 | XSETFASTINT (w->window_end_pos, 0); |
| 3294 | XSETFASTINT (w->window_end_vpos, 0); | 3291 | XSETFASTINT (w->window_end_vpos, 0); |
| @@ -3488,8 +3485,8 @@ window_resize_apply (struct window *w, int horflag) | |||
| 3488 | } | 3485 | } |
| 3489 | 3486 | ||
| 3490 | /* Clear out some redisplay caches. */ | 3487 | /* Clear out some redisplay caches. */ |
| 3491 | XSETFASTINT (w->last_modified, 0); | 3488 | w->last_modified = 0; |
| 3492 | XSETFASTINT (w->last_overlay_modified, 0); | 3489 | w->last_overlay_modified = 0; |
| 3493 | } | 3490 | } |
| 3494 | 3491 | ||
| 3495 | 3492 | ||
| @@ -4021,8 +4018,8 @@ grow_mini_window (struct window *w, int delta) | |||
| 4021 | /* Grow the mini-window. */ | 4018 | /* Grow the mini-window. */ |
| 4022 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); | 4019 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); |
| 4023 | XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); | 4020 | XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); |
| 4024 | XSETFASTINT (w->last_modified, 0); | 4021 | w->last_modified = 0; |
| 4025 | XSETFASTINT (w->last_overlay_modified, 0); | 4022 | w->last_overlay_modified = 0; |
| 4026 | 4023 | ||
| 4027 | adjust_glyphs (f); | 4024 | adjust_glyphs (f); |
| 4028 | UNBLOCK_INPUT; | 4025 | UNBLOCK_INPUT; |
| @@ -4057,8 +4054,8 @@ shrink_mini_window (struct window *w) | |||
| 4057 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); | 4054 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); |
| 4058 | XSETFASTINT (w->total_lines, 1); | 4055 | XSETFASTINT (w->total_lines, 1); |
| 4059 | 4056 | ||
| 4060 | XSETFASTINT (w->last_modified, 0); | 4057 | w->last_modified = 0; |
| 4061 | XSETFASTINT (w->last_overlay_modified, 0); | 4058 | w->last_overlay_modified = 0; |
| 4062 | 4059 | ||
| 4063 | adjust_glyphs (f); | 4060 | adjust_glyphs (f); |
| 4064 | UNBLOCK_INPUT; | 4061 | UNBLOCK_INPUT; |
| @@ -4285,8 +4282,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4285 | w->buffer); | 4282 | w->buffer); |
| 4286 | w->start_at_line_beg = 1; | 4283 | w->start_at_line_beg = 1; |
| 4287 | w->update_mode_line = 1; | 4284 | w->update_mode_line = 1; |
| 4288 | XSETFASTINT (w->last_modified, 0); | 4285 | w->last_modified = 0; |
| 4289 | XSETFASTINT (w->last_overlay_modified, 0); | 4286 | w->last_overlay_modified = 0; |
| 4290 | /* Set force_start so that redisplay_window will run the | 4287 | /* Set force_start so that redisplay_window will run the |
| 4291 | window-scroll-functions. */ | 4288 | window-scroll-functions. */ |
| 4292 | w->force_start = 1; | 4289 | w->force_start = 1; |
| @@ -4431,8 +4428,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4431 | bytepos = XMARKER (w->start)->bytepos; | 4428 | bytepos = XMARKER (w->start)->bytepos; |
| 4432 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); | 4429 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); |
| 4433 | w->update_mode_line = 1; | 4430 | w->update_mode_line = 1; |
| 4434 | XSETFASTINT (w->last_modified, 0); | 4431 | w->last_modified = 0; |
| 4435 | XSETFASTINT (w->last_overlay_modified, 0); | 4432 | w->last_overlay_modified = 0; |
| 4436 | /* Set force_start so that redisplay_window will run the | 4433 | /* Set force_start so that redisplay_window will run the |
| 4437 | window-scroll-functions. */ | 4434 | window-scroll-functions. */ |
| 4438 | w->force_start = 1; | 4435 | w->force_start = 1; |
| @@ -4585,10 +4582,10 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4585 | struct position posit | 4582 | struct position posit |
| 4586 | = *compute_motion (startpos, 0, 0, 0, | 4583 | = *compute_motion (startpos, 0, 0, 0, |
| 4587 | PT, ht, 0, | 4584 | PT, ht, 0, |
| 4588 | -1, XINT (w->hscroll), | 4585 | -1, w->hscroll, |
| 4589 | 0, w); | 4586 | 0, w); |
| 4590 | window_scroll_preserve_vpos = posit.vpos; | 4587 | window_scroll_preserve_vpos = posit.vpos; |
| 4591 | window_scroll_preserve_hpos = posit.hpos + XINT (w->hscroll); | 4588 | window_scroll_preserve_hpos = posit.hpos + w->hscroll; |
| 4592 | } | 4589 | } |
| 4593 | 4590 | ||
| 4594 | original_pos = Fcons (make_number (window_scroll_preserve_hpos), | 4591 | original_pos = Fcons (make_number (window_scroll_preserve_hpos), |
| @@ -4630,8 +4627,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4630 | set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); | 4627 | set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); |
| 4631 | w->start_at_line_beg = !NILP (bolp); | 4628 | w->start_at_line_beg = !NILP (bolp); |
| 4632 | w->update_mode_line = 1; | 4629 | w->update_mode_line = 1; |
| 4633 | XSETFASTINT (w->last_modified, 0); | 4630 | w->last_modified = 0; |
| 4634 | XSETFASTINT (w->last_overlay_modified, 0); | 4631 | w->last_overlay_modified = 0; |
| 4635 | /* Set force_start so that redisplay_window will run | 4632 | /* Set force_start so that redisplay_window will run |
| 4636 | the window-scroll-functions. */ | 4633 | the window-scroll-functions. */ |
| 4637 | w->force_start = 1; | 4634 | w->force_start = 1; |
| @@ -4872,7 +4869,7 @@ by this function. This happens in an interactive call. */) | |||
| 4872 | (register Lisp_Object arg, Lisp_Object set_minimum) | 4869 | (register Lisp_Object arg, Lisp_Object set_minimum) |
| 4873 | { | 4870 | { |
| 4874 | Lisp_Object result; | 4871 | Lisp_Object result; |
| 4875 | EMACS_INT hscroll; | 4872 | ptrdiff_t hscroll; |
| 4876 | struct window *w = XWINDOW (selected_window); | 4873 | struct window *w = XWINDOW (selected_window); |
| 4877 | 4874 | ||
| 4878 | if (NILP (arg)) | 4875 | if (NILP (arg)) |
| @@ -4880,7 +4877,7 @@ by this function. This happens in an interactive call. */) | |||
| 4880 | else | 4877 | else |
| 4881 | arg = Fprefix_numeric_value (arg); | 4878 | arg = Fprefix_numeric_value (arg); |
| 4882 | 4879 | ||
| 4883 | hscroll = XINT (w->hscroll) + XINT (arg); | 4880 | hscroll = w->hscroll + XINT (arg); |
| 4884 | result = Fset_window_hscroll (selected_window, make_number (hscroll)); | 4881 | result = Fset_window_hscroll (selected_window, make_number (hscroll)); |
| 4885 | 4882 | ||
| 4886 | if (!NILP (set_minimum)) | 4883 | if (!NILP (set_minimum)) |
| @@ -4901,7 +4898,7 @@ by this function. This happens in an interactive call. */) | |||
| 4901 | (register Lisp_Object arg, Lisp_Object set_minimum) | 4898 | (register Lisp_Object arg, Lisp_Object set_minimum) |
| 4902 | { | 4899 | { |
| 4903 | Lisp_Object result; | 4900 | Lisp_Object result; |
| 4904 | EMACS_INT hscroll; | 4901 | ptrdiff_t hscroll; |
| 4905 | struct window *w = XWINDOW (selected_window); | 4902 | struct window *w = XWINDOW (selected_window); |
| 4906 | 4903 | ||
| 4907 | if (NILP (arg)) | 4904 | if (NILP (arg)) |
| @@ -4909,7 +4906,7 @@ by this function. This happens in an interactive call. */) | |||
| 4909 | else | 4906 | else |
| 4910 | arg = Fprefix_numeric_value (arg); | 4907 | arg = Fprefix_numeric_value (arg); |
| 4911 | 4908 | ||
| 4912 | hscroll = XINT (w->hscroll) - XINT (arg); | 4909 | hscroll = w->hscroll - XINT (arg); |
| 4913 | result = Fset_window_hscroll (selected_window, make_number (hscroll)); | 4910 | result = Fset_window_hscroll (selected_window, make_number (hscroll)); |
| 4914 | 4911 | ||
| 4915 | if (!NILP (set_minimum)) | 4912 | if (!NILP (set_minimum)) |
| @@ -5537,8 +5534,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5537 | w->total_lines = p->total_lines; | 5534 | w->total_lines = p->total_lines; |
| 5538 | w->normal_cols = p->normal_cols; | 5535 | w->normal_cols = p->normal_cols; |
| 5539 | w->normal_lines = p->normal_lines; | 5536 | w->normal_lines = p->normal_lines; |
| 5540 | w->hscroll = p->hscroll; | 5537 | w->hscroll = XFASTINT (p->hscroll); |
| 5541 | w->min_hscroll = p->min_hscroll; | 5538 | w->min_hscroll = XFASTINT (p->min_hscroll); |
| 5542 | w->display_table = p->display_table; | 5539 | w->display_table = p->display_table; |
| 5543 | w->left_margin_cols = p->left_margin_cols; | 5540 | w->left_margin_cols = p->left_margin_cols; |
| 5544 | w->right_margin_cols = p->right_margin_cols; | 5541 | w->right_margin_cols = p->right_margin_cols; |
| @@ -5571,8 +5568,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5571 | } | 5568 | } |
| 5572 | } | 5569 | } |
| 5573 | 5570 | ||
| 5574 | XSETFASTINT (w->last_modified, 0); | 5571 | w->last_modified = 0; |
| 5575 | XSETFASTINT (w->last_overlay_modified, 0); | 5572 | w->last_overlay_modified = 0; |
| 5576 | 5573 | ||
| 5577 | /* Reinstall the saved buffer and pointers into it. */ | 5574 | /* Reinstall the saved buffer and pointers into it. */ |
| 5578 | if (NILP (p->buffer)) | 5575 | if (NILP (p->buffer)) |
| @@ -5811,7 +5808,7 @@ get_phys_cursor_glyph (struct window *w) | |||
| 5811 | if (!row->enabled_p) | 5808 | if (!row->enabled_p) |
| 5812 | return NULL; | 5809 | return NULL; |
| 5813 | 5810 | ||
| 5814 | if (XINT (w->hscroll)) | 5811 | if (w->hscroll) |
| 5815 | { | 5812 | { |
| 5816 | /* When the window is hscrolled, cursor hpos can legitimately be | 5813 | /* When the window is hscrolled, cursor hpos can legitimately be |
| 5817 | out of bounds, but we draw the cursor at the corresponding | 5814 | out of bounds, but we draw the cursor at the corresponding |
| @@ -5853,8 +5850,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 5853 | p->total_lines = w->total_lines; | 5850 | p->total_lines = w->total_lines; |
| 5854 | p->normal_cols = w->normal_cols; | 5851 | p->normal_cols = w->normal_cols; |
| 5855 | p->normal_lines = w->normal_lines; | 5852 | p->normal_lines = w->normal_lines; |
| 5856 | p->hscroll = w->hscroll; | 5853 | XSETFASTINT (p->hscroll, w->hscroll); |
| 5857 | p->min_hscroll = w->min_hscroll; | 5854 | XSETFASTINT (p->min_hscroll, w->min_hscroll); |
| 5858 | p->display_table = w->display_table; | 5855 | p->display_table = w->display_table; |
| 5859 | p->left_margin_cols = w->left_margin_cols; | 5856 | p->left_margin_cols = w->left_margin_cols; |
| 5860 | p->right_margin_cols = w->right_margin_cols; | 5857 | p->right_margin_cols = w->right_margin_cols; |