=== added file 'admin/coccinelle/window.cocci' --- admin/coccinelle/window.cocci 1970-01-01 00:00:00 +0000 +++ admin/coccinelle/window.cocci 2012-06-27 04:53:35 +0000 @@ -0,0 +1,140 @@ +// Make changes needed after converting slots of `struct window' +// from Lisp_Object to: +// - last_point -> ptrdiff_t +// - last_modified -> EMACS_INT +// - last_overlay_modified -> EMACS_INT +// - window_end_pos -> ptrdiff_t +// - window_end_vpos -> ptrdiff_t +@@ +expression E; +identifier W; +@@ +( +- XSETFASTINT (XWINDOW (W)->last_point, E) ++ XWINDOW (W)->last_point = E +| +- XSETFASTINT (W->last_point, E) ++ W->last_point = E +| +- XFASTINT (XWINDOW (W)->last_point) ++ XWINDOW (W)->last_point +| +- XFASTINT (W->last_point) ++ W->last_point +| +- XINT (XWINDOW (W)->last_point) ++ XWINDOW (W)->last_point +| +- XINT (W->last_point) ++ W->last_point +| +- XWINDOW (W)->last_point = make_number (E) ++ XWINDOW (W)->last_point = E +| +- W->last_point = make_number (E) ++ W->last_point = E + +| + +- XSETFASTINT (XWINDOW (W)->last_modified, E) ++ XWINDOW (W)->last_modified = E +| +- XSETFASTINT (W->last_modified, E) ++ W->last_modified = E +| +- XFASTINT (XWINDOW (W)->last_modified) ++ XWINDOW (W)->last_modified +| +- XFASTINT (W->last_modified) ++ W->last_modified +| +- XINT (XWINDOW (W)->last_modified) ++ XWINDOW (W)->last_modified +| +- XINT (W->last_modified) ++ W->last_modified +| +- XWINDOW (W)->last_modified = make_number (E) ++ XWINDOW (W)->last_modified = E +| +- W->last_modified = make_number (E) ++ W->last_modified = E + +| + +- XSETFASTINT (XWINDOW (W)->last_overlay_modified, E) ++ XWINDOW (W)->last_overlay_modified = E +| +- XSETFASTINT (W->last_overlay_modified, E) ++ W->last_overlay_modified = E +| +- XFASTINT (XWINDOW (W)->last_overlay_modified) ++ XWINDOW (W)->last_overlay_modified +| +- XFASTINT (W->last_overlay_modified) ++ W->last_overlay_modified +| +- XINT (XWINDOW (W)->last_overlay_modified) ++ XWINDOW (W)->last_overlay_modified +| +- XINT (W->last_overlay_modified) ++ W->last_overlay_modified +| +- XWINDOW (W)->last_overlay_modified = make_number (E) ++ XWINDOW (W)->last_overlay_modified = E +| +- W->last_overlay_modified = make_number (E) ++ W->last_overlay_modified = E + +| + +- XSETFASTINT (XWINDOW (W)->window_end_pos, E) ++ XWINDOW (W)->window_end_pos = E +| +- XSETFASTINT (W->window_end_pos, E) ++ W->window_end_pos = E +| +- XFASTINT (XWINDOW (W)->window_end_pos) ++ XWINDOW (W)->window_end_pos +| +- XFASTINT (W->window_end_pos) ++ W->window_end_pos +| +- XINT (XWINDOW (W)->window_end_pos) ++ XWINDOW (W)->window_end_pos +| +- XINT (W->window_end_pos) ++ W->window_end_pos +| +- XWINDOW (W)->window_end_pos = make_number (E) ++ XWINDOW (W)->window_end_pos = E +| +- W->window_end_pos = make_number (E) ++ W->window_end_pos = E + +| + +- XSETFASTINT (XWINDOW (W)->window_end_vpos, E) ++ XWINDOW (W)->window_end_vpos = E +| +- XSETFASTINT (W->window_end_vpos, E) ++ W->window_end_vpos = E +| +- XFASTINT (XWINDOW (W)->window_end_vpos) ++ XWINDOW (W)->window_end_vpos +| +- XFASTINT (W->window_end_vpos) ++ W->window_end_vpos +| +- XINT (XWINDOW (W)->window_end_vpos) ++ XWINDOW (W)->window_end_vpos +| +- XINT (W->window_end_vpos) ++ W->window_end_vpos +| +- XWINDOW (W)->window_end_vpos = make_number (E) ++ XWINDOW (W)->window_end_vpos = E +| +- W->window_end_vpos = make_number (E) ++ W->window_end_vpos = E +) === modified file 'src/dispnew.c' --- src/dispnew.c 2012-06-24 04:11:19 +0000 +++ src/dispnew.c 2012-06-27 04:52:47 +0000 @@ -643,8 +643,7 @@ /* Window end is invalid, if inside of the rows that are invalidated below. */ - if (INTEGERP (w->window_end_vpos) - && XFASTINT (w->window_end_vpos) >= i) + if (w->window_end_vpos >= i) w->window_end_valid = Qnil; while (i < matrix->nrows) === modified file 'src/frame.c' --- src/frame.c 2012-06-26 14:41:01 +0000 +++ src/frame.c 2012-06-27 04:52:47 +0000 @@ -131,7 +131,7 @@ { struct window *w = XWINDOW (window); - XSETFASTINT (w->last_modified, 0); + w->last_modified = 0; XSETFASTINT (w->top_line, XFASTINT (w->top_line) + n); XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - n); @@ -356,8 +356,7 @@ f->selected_window = root_window; /* Make sure this window seems more recently used than a newly-created, never-selected window. */ - ++window_select_count; - XSETFASTINT (XWINDOW (f->selected_window)->use_time, window_select_count); + XWINDOW (f->selected_window)->use_time = ++window_select_count; return f; } === modified file 'src/minibuf.c' --- src/minibuf.c 2012-06-19 17:05:41 +0000 +++ src/minibuf.c 2012-06-27 04:52:47 +0000 @@ -888,8 +888,8 @@ /* Make sure minibuffer window is erased, not ignored. */ windows_or_buffers_changed++; - XSETFASTINT (XWINDOW (window)->last_modified, 0); - XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0); + XWINDOW (window)->last_modified = 0; + XWINDOW (window)->last_overlay_modified = 0; /* In case the previous minibuffer displayed in this miniwindow is dead, we may keep displaying this buffer (tho it's inactive), so reset it, === modified file 'src/print.c' --- src/print.c 2012-06-26 02:33:51 +0000 +++ src/print.c 2012-06-27 04:52:47 +0000 @@ -1774,8 +1774,7 @@ { int len; strout ("#sequence_number)); + len = sprintf (buf, "%d", XWINDOW (obj)->sequence_number); strout (buf, len, len, printcharfun); if (!NILP (XWINDOW (obj)->buffer)) { === modified file 'src/window.c' --- src/window.c 2012-06-26 14:41:01 +0000 +++ src/window.c 2012-06-27 04:52:47 +0000 @@ -117,9 +117,6 @@ /* Incremented for each window created. */ static int sequence_number; -/* Nonzero after init_window_once has finished. */ -static int window_initialized; - /* Hook to run when window config changes. */ static Lisp_Object Qwindow_configuration_change_hook; @@ -331,8 +328,7 @@ if (NILP (norecord)) { - ++window_select_count; - XSETFASTINT (w->use_time, window_select_count); + w->use_time = ++window_select_count; record_buffer (w->buffer); } @@ -499,7 +495,7 @@ selected one. */) (Lisp_Object window) { - return decode_window (window)->use_time; + return make_number (decode_window (window)->use_time); } DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, @@ -1314,8 +1310,8 @@ if (! NILP (update) && ! (! NILP (w->window_end_valid) - && XFASTINT (w->last_modified) >= BUF_MODIFF (b) - && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (b)) + && w->last_modified >= BUF_MODIFF (b) + && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b)) && !noninteractive) { struct text_pos startp; @@ -1355,7 +1351,7 @@ set_buffer_internal (old_buffer); } else - XSETINT (value, BUF_Z (b) - XFASTINT (w->window_end_pos)); + XSETINT (value, BUF_Z (b) - w->window_end_pos); return value; } @@ -1398,8 +1394,8 @@ if (NILP (noforce)) w->force_start = 1; w->update_mode_line = 1; - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; if (!EQ (window, selected_window)) windows_or_buffers_changed++; @@ -1511,8 +1507,8 @@ if (NILP (w->window_end_valid) || current_buffer->clip_changed || current_buffer->prevent_redisplay_optimizations_p - || XFASTINT (w->last_modified) < BUF_MODIFF (b) - || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) + || w->last_modified < BUF_MODIFF (b) + || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b)) return Qnil; if (NILP (line)) @@ -1842,8 +1838,8 @@ n->phys_cursor_width = -1; n->must_be_updated_p = 0; n->pseudo_window_p = 0; - XSETFASTINT (n->window_end_vpos, 0); - XSETFASTINT (n->window_end_pos, 0); + n->window_end_vpos = 0; + n->window_end_pos = 0; n->window_end_valid = Qnil; n->frozen_window_start_p = 0; } @@ -2990,8 +2986,8 @@ XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1); BVAR (b, display_time) = Fcurrent_time (); - XSETFASTINT (w->window_end_pos, 0); - XSETFASTINT (w->window_end_vpos, 0); + w->window_end_pos = 0; + w->window_end_vpos = 0; memset (&w->last_cursor, 0, sizeof w->last_cursor); w->window_end_valid = Qnil; if (!(keep_margins_p && samebuf)) @@ -3011,8 +3007,8 @@ buffer); w->start_at_line_beg = 0; w->force_start = 0; - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; } /* Maybe we could move this into the `if' but it's not obviously safe and I doubt it's worth the trouble. */ @@ -3021,7 +3017,7 @@ /* We must select BUFFER for running the window-scroll-functions. */ /* We can't check ! NILP (Vwindow_scroll_functions) here because that might itself be a local variable. */ - if (window_initialized) + if (initialized) { record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); Fset_buffer (buffer); @@ -3250,8 +3246,7 @@ sizeof (Lisp_Object) * VECSIZE (struct window)); XSETWINDOW (parent, p); - ++sequence_number; - XSETFASTINT (p->sequence_number, sequence_number); + p->sequence_number = ++sequence_number; replace_window (window, parent, 1); @@ -3290,17 +3285,12 @@ w->pointm = Fmake_marker (); XSETFASTINT (w->hscroll, 0); XSETFASTINT (w->min_hscroll, 0); - XSETFASTINT (w->use_time, 0); - ++sequence_number; - XSETFASTINT (w->sequence_number, sequence_number); - XSETFASTINT (w->last_point, 0); w->vertical_scroll_bar_type = Qt; - XSETFASTINT (w->window_end_pos, 0); - XSETFASTINT (w->window_end_vpos, 0); /* Initialize non-Lisp data. Note that allocate_window zeroes out all non-Lisp data, so do it only for slots which should not be zero. */ w->nrows_scale_factor = w->ncols_scale_factor = 1; + w->sequence_number = ++sequence_number; w->phys_cursor_type = -1; w->phys_cursor_width = -1; @@ -3492,8 +3482,8 @@ } /* Clear out some redisplay caches. */ - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; } @@ -4025,8 +4015,8 @@ /* Grow the mini-window. */ XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; adjust_glyphs (f); UNBLOCK_INPUT; @@ -4061,8 +4051,8 @@ XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); XSETFASTINT (w->total_lines, 1); - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; adjust_glyphs (f); UNBLOCK_INPUT; @@ -4289,8 +4279,8 @@ w->buffer); w->start_at_line_beg = 1; w->update_mode_line = 1; - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; /* Set force_start so that redisplay_window will run the window-scroll-functions. */ w->force_start = 1; @@ -4435,8 +4425,8 @@ bytepos = XMARKER (w->start)->bytepos; w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); w->update_mode_line = 1; - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; /* Set force_start so that redisplay_window will run the window-scroll-functions. */ w->force_start = 1; @@ -4634,8 +4624,8 @@ set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); w->start_at_line_beg = !NILP (bolp); w->update_mode_line = 1; - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; /* Set force_start so that redisplay_window will run the window-scroll-functions. */ w->force_start = 1; @@ -5575,8 +5565,8 @@ } } - XSETFASTINT (w->last_modified, 0); - XSETFASTINT (w->last_overlay_modified, 0); + w->last_modified = 0; + w->last_overlay_modified = 0; /* Reinstall the saved buffer and pointers into it. */ if (NILP (p->buffer)) @@ -6478,8 +6468,6 @@ minibuf_window = f->minibuffer_window; selected_window = f->selected_window; last_nonminibuf_frame = f; - - window_initialized = 1; } void === modified file 'src/window.h' --- src/window.h 2012-06-01 03:41:03 +0000 +++ src/window.h 2012-06-27 06:24:25 +0000 @@ -147,24 +147,10 @@ the user has set, by set-window-hscroll for example. */ Lisp_Object min_hscroll; - /* Number saying how recently window was selected. */ - Lisp_Object use_time; - - /* Unique number of window assigned when it was created. */ - Lisp_Object sequence_number; - /* No permanent meaning; used by save-window-excursion's bookkeeping. */ Lisp_Object temslot; - /* text.modified of displayed buffer as of last time display - completed. */ - Lisp_Object last_modified; - /* BUF_OVERLAY_MODIFIED of displayed buffer as of last complete update. */ - Lisp_Object last_overlay_modified; - /* Value of point at that time. */ - Lisp_Object last_point; - /* This window's vertical scroll bar. This field is only for use by the window-system-dependent code which implements the scroll bars; it can store anything it likes here. If this @@ -191,16 +177,10 @@ no scroll bar. A value of t means use frame value. */ Lisp_Object vertical_scroll_bar_type; - /* Z - the buffer position of the last glyph in the current matrix - of W. Only valid if WINDOW_END_VALID is not nil. */ - Lisp_Object window_end_pos; - /* Glyph matrix row of the last glyph in the current matrix - of W. Only valid if WINDOW_END_VALID is not nil. */ - Lisp_Object window_end_vpos; - /* t if window_end_pos is truly valid. - This is nil if nontrivial redisplay is preempted - since in that case the frame image that window_end_pos - did not get onto the frame. */ + /* t if window_end_pos is truly valid. This is nil if nontrivial + redisplay is preempted since in that case the frame image that + window_end_pos did not get onto the frame. FIXME: check whether + this may be converted to a bitfield or even eliminated at all. */ Lisp_Object window_end_valid; /* Display-table to use for displaying chars in this window. @@ -254,6 +234,31 @@ struct glyph_matrix *current_matrix; struct glyph_matrix *desired_matrix; + /* Number saying how recently window was selected. */ + int use_time; + + /* Unique number of window assigned when it was created. */ + int sequence_number; + + /* Displayed buffer's text modification events counter as of last time + display completed. */ + EMACS_INT last_modified; + + /* Displayed buffer's overlays modification events counter as of last + complete update. */ + EMACS_INT last_overlay_modified; + + /* Value of point at that time. */ + ptrdiff_t last_point; + + /* Z - the buffer position of the last glyph in the current matrix + of W. Only valid if WINDOW_END_VALID is not nil. */ + ptrdiff_t window_end_pos; + + /* Glyph matrix row of the last glyph in the current matrix + of W. Only valid if WINDOW_END_VALID is not nil. */ + ptrdiff_t window_end_vpos; + /* Scaling factor for the glyph_matrix size calculation in this window. Used if window contains many small images or uses proportional fonts, as the normal may yield a matrix which is too small. */ === modified file 'src/xdisp.c' --- src/xdisp.c 2012-06-26 02:33:51 +0000 +++ src/xdisp.c 2012-06-27 06:57:43 +0000 @@ -2508,7 +2508,7 @@ { struct glyph_row *row; xassert ((row = MATRIX_ROW (w->current_matrix, - XFASTINT (w->window_end_vpos)), + w->window_end_vpos), !row->enabled_p || MATRIX_ROW_DISPLAYS_TEXT_P (row) || MATRIX_ROW_VPOS (row, w->current_matrix) == 0)); @@ -8850,7 +8850,7 @@ && it->current_x == it->last_visible_x - 1 && it->c != '\n' && it->c != '\t' - && it->vpos < XFASTINT (it->w->window_end_vpos)) + && it->vpos < it->w->window_end_vpos) { it->continuation_lines_width += it->current_x; it->current_x = it->hpos = it->max_ascent = it->max_descent = 0; @@ -12508,8 +12508,8 @@ int unchanged_p = 1; /* If text or overlays have changed, see where. */ - if (XFASTINT (w->last_modified) < MODIFF - || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF) + if (w->last_modified < MODIFF + || w->last_overlay_modified < OVERLAY_MODIFF) { /* Gap in the line? */ if (GPT < start || Z - GPT < end) @@ -12788,9 +12788,9 @@ pt = marker_position (w->pointm); if ((w->current_matrix->buffer != XBUFFER (w->buffer) - || pt != XINT (w->last_point)) + || pt != w->last_point) && check_point_in_composition (w->current_matrix->buffer, - XINT (w->last_point), + w->last_point, XBUFFER (w->buffer), pt)) b->clip_changed = 1; } @@ -13012,9 +13012,9 @@ if (!NILP (w->column_number_displayed) /* This alternative quickly identifies a common case where no change is needed. */ - && !(PT == XFASTINT (w->last_point) - && XFASTINT (w->last_modified) >= MODIFF - && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF) + && !(PT == w->last_point + && w->last_modified >= MODIFF + && w->last_overlay_modified >= OVERLAY_MODIFF) && (XFASTINT (w->column_number_displayed) != current_column ())) w->update_mode_line = 1; @@ -13077,8 +13077,8 @@ } else if (EQ (selected_window, minibuf_window) && (current_buffer->clip_changed - || XFASTINT (w->last_modified) < MODIFF - || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF) + || w->last_modified < MODIFF + || w->last_overlay_modified < OVERLAY_MODIFF) && resize_mini_window (w, 0)) { /* Resized active mini-window to fit the size of what it is @@ -13143,8 +13143,8 @@ || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n')) /* Former continuation line has disappeared by becoming empty. */ goto cancel; - else if (XFASTINT (w->last_modified) < MODIFF - || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF + else if (w->last_modified < MODIFF + || w->last_overlay_modified < OVERLAY_MODIFF || MINI_WINDOW_P (w)) { /* We have to handle the case of continuation around a @@ -13224,12 +13224,12 @@ adjusted. */ if ((it.glyph_row - 1)->displays_text_p) { - if (XFASTINT (w->window_end_vpos) < this_line_vpos) - XSETINT (w->window_end_vpos, this_line_vpos); + if (w->window_end_vpos < this_line_vpos) + w->window_end_vpos = this_line_vpos; } - else if (XFASTINT (w->window_end_vpos) == this_line_vpos + else if (w->window_end_vpos == this_line_vpos && this_line_vpos > 0) - XSETINT (w->window_end_vpos, this_line_vpos - 1); + w->window_end_vpos = this_line_vpos - 1; w->window_end_valid = Qnil; /* Update hint: No need to try to scroll in update_window. */ @@ -13248,7 +13248,7 @@ goto cancel; } else if (/* Cursor position hasn't changed. */ - PT == XFASTINT (w->last_point) + PT == w->last_point /* Make sure the cursor was last displayed in this window. Otherwise we have to reposition it. */ && 0 <= w->cursor.vpos @@ -13664,10 +13664,8 @@ { struct buffer *b = XBUFFER (w->buffer); - w->last_modified - = make_number (accurate_p ? BUF_MODIFF (b) : 0); - w->last_overlay_modified - = make_number (accurate_p ? BUF_OVERLAY_MODIFF (b) : 0); + w->last_modified = accurate_p ? BUF_MODIFF (b) : 0; + w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF (b) : 0; w->last_had_star = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b); @@ -13689,9 +13687,9 @@ w->last_cursor_off_p = w->cursor_off_p; if (w == XWINDOW (selected_window)) - w->last_point = make_number (BUF_PT (b)); + w->last_point = BUF_PT (b); else - w->last_point = make_number (XMARKER (w->pointm)->charpos); + w->last_point = XMARKER (w->pointm)->charpos; } } @@ -14932,6 +14930,11 @@ return rc; #endif + /* Previously there was a runtime check whether last_point is non-nil. + Now it's converted to ptrdiff_t, so zero means invalid position in + a buffer. */ + eassert (w->last_point > 0); + /* Handle case where text has not changed, only point, and it has not moved off the frame. */ if (/* Point may be in this window. */ @@ -14952,8 +14955,6 @@ && !NILP (BVAR (current_buffer, mark_active))) && NILP (w->region_showing) && NILP (Vshow_trailing_whitespace) - /* Right after splitting windows, last_point may be nil. */ - && INTEGERP (w->last_point) /* This code is not used for mini-buffer for the sake of the case of redisplaying to replace an echo area message; since in that case the mini-buffer contents per se are usually @@ -14962,12 +14963,11 @@ handles the same cases. */ && !EQ (window, minibuf_window) /* When splitting windows or for new windows, it happens that - redisplay is called with a nil window_end_vpos or one being - larger than the window. This should really be fixed in - window.c. I don't have this on my list, now, so we do - approximately the same as the old redisplay code. --gerd. */ - && INTEGERP (w->window_end_vpos) - && XFASTINT (w->window_end_vpos) < w->current_matrix->nrows + redisplay is called with a zero window_end_vpos or one being + larger than the window. FIXME: Gerd has said that this should + be fixed in window.c; anyway, this needs to be checked. */ + && w->window_end_vpos > 0 + && w->window_end_vpos < w->current_matrix->nrows && (FRAME_WINDOW_P (f) || !overlay_arrow_in_current_buffer_p ())) { @@ -15011,7 +15011,7 @@ int scroll_p = 0, must_scroll = 0; int last_y = window_text_bottom_y (w) - this_scroll_margin; - if (PT > XFASTINT (w->last_point)) + if (PT > w->last_point) { /* Point has moved forward. */ while (MATRIX_ROW_END_CHARPOS (row) < PT @@ -15046,7 +15046,7 @@ && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))) scroll_p = 1; } - else if (PT < XFASTINT (w->last_point)) + else if (PT < w->last_point) { /* Cursor has to be moved backward. Note that PT >= CHARPOS (startp) because of the outer if-statement. */ @@ -15279,7 +15279,7 @@ start = marker_position (w->start) - BUF_BEGV (buf); /* I don't think this is guaranteed to be right. For the moment, we'll pretend it is. */ - end = BUF_Z (buf) - XFASTINT (w->window_end_pos) - BUF_BEGV (buf); + end = BUF_Z (buf) - w->window_end_pos - BUF_BEGV (buf); if (end < start) end = start; @@ -15392,8 +15392,8 @@ = (!NILP (w->window_end_valid) && !current_buffer->clip_changed && !current_buffer->prevent_redisplay_optimizations_p - && XFASTINT (w->last_modified) >= MODIFF - && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF); + && w->last_modified >= MODIFF + && w->last_overlay_modified >= OVERLAY_MODIFF); /* Run the window-bottom-change-functions if it is possible that the text on the screen has changed @@ -15415,8 +15415,8 @@ buffer_unchanged_p = (!NILP (w->window_end_valid) && !current_buffer->clip_changed - && XFASTINT (w->last_modified) >= MODIFF - && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF); + && w->last_modified >= MODIFF + && w->last_overlay_modified >= OVERLAY_MODIFF); /* When windows_or_buffers_changed is non-zero, we can't rely on the window end being valid, so set it to nil there. */ @@ -15441,9 +15441,9 @@ if (!NILP (w->column_number_displayed) /* This alternative quickly identifies a common case where no change is needed. */ - && !(PT == XFASTINT (w->last_point) - && XFASTINT (w->last_modified) >= MODIFF - && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF) + && !(PT == w->last_point + && w->last_modified >= MODIFF + && w->last_overlay_modified >= OVERLAY_MODIFF) && (XFASTINT (w->column_number_displayed) != current_column ())) update_mode_line = 1; @@ -15559,8 +15559,8 @@ startp = run_window_scroll_functions (window, startp); } - w->last_modified = make_number (0); - w->last_overlay_modified = make_number (0); + w->last_modified = 0; + w->last_overlay_modified = 0; if (CHARPOS (startp) < BEGV) SET_TEXT_POS (startp, BEGV, BEGV_BYTE); else if (CHARPOS (startp) > ZV) @@ -15685,8 +15685,8 @@ && (CHARPOS (startp) < ZV /* Avoid starting at end of buffer. */ || CHARPOS (startp) == BEGV - || (XFASTINT (w->last_modified) >= MODIFF - && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF))) + || (w->last_modified >= MODIFF + && w->last_overlay_modified >= OVERLAY_MODIFF))) { int d1, d2, d3, d4, d5, d6; @@ -15773,8 +15773,8 @@ try_to_scroll: - w->last_modified = make_number (0); - w->last_overlay_modified = make_number (0); + w->last_modified = 0; + w->last_overlay_modified = 0; /* Redisplay the mode line. Select the buffer properly for that. */ if (!update_mode_line) @@ -15962,7 +15962,7 @@ if (w->cursor.vpos < 0) { if (!NILP (w->window_end_valid) - && PT >= Z - XFASTINT (w->window_end_pos)) + && PT >= Z - w->window_end_pos) { clear_glyph_matrix (w->desired_matrix); move_it_by_lines (&it, 1); @@ -16251,7 +16251,7 @@ } /* If bottom moved off end of frame, change mode line percentage. */ - if (XFASTINT (w->window_end_pos) <= 0 + if (w->window_end_pos <= 0 && Z != IT_CHARPOS (it)) w->update_mode_line = 1; @@ -16263,18 +16263,16 @@ xassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - w->window_end_pos - = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); - w->window_end_vpos - = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); - xassert (MATRIX_ROW (w->desired_matrix, XFASTINT (w->window_end_vpos)) + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (last_text_row); + w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); + xassert (MATRIX_ROW (w->desired_matrix, w->window_end_vpos) ->displays_text_p); } else { w->window_end_bytepos = Z_BYTE - ZV_BYTE; - w->window_end_pos = make_number (Z - ZV); - w->window_end_vpos = make_number (0); + w->window_end_pos = Z - ZV; + w->window_end_vpos = 0; } /* But that is not valid info until redisplay finishes. */ @@ -16502,27 +16500,22 @@ { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); - w->window_end_pos - = make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row)); - w->window_end_vpos - = make_number (MATRIX_ROW_VPOS (last_reused_text_row, - w->current_matrix)); + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row); + w->window_end_vpos = MATRIX_ROW_VPOS (last_reused_text_row, w->current_matrix); } else if (last_text_row) { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - w->window_end_pos - = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); - w->window_end_vpos - = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (last_text_row); + w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); } else { /* This window must be completely empty. */ w->window_end_bytepos = Z_BYTE - ZV_BYTE; - w->window_end_pos = make_number (Z - ZV); - w->window_end_vpos = make_number (0); + w->window_end_pos = Z - ZV; + w->window_end_vpos = 0; } w->window_end_valid = Qnil; @@ -16705,15 +16698,13 @@ { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - w->window_end_pos - = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); - w->window_end_vpos - = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (last_text_row); + w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); } else { w->window_end_vpos - = make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled); + = make_number (w->window_end_vpos - nrows_scrolled); } w->window_end_valid = Qnil; @@ -16854,11 +16845,11 @@ /* A value of window_end_pos >= END_UNCHANGED means that the window end is in the range of changed text. If so, there is no unchanged row at the end of W's current matrix. */ - if (XFASTINT (w->window_end_pos) >= END_UNCHANGED) + if (w->window_end_pos >= END_UNCHANGED) return NULL; /* Set row to the last row in W's current matrix displaying text. */ - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + row = MATRIX_ROW (w->current_matrix, w->window_end_vpos); /* If matrix is entirely empty, no unchanged row exists. */ if (MATRIX_ROW_DISPLAYS_TEXT_P (row)) @@ -16869,7 +16860,7 @@ buffer positions in the current matrix to current buffer positions for characters not in changed text. */ ptrdiff_t Z_old = - MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); + MATRIX_ROW_END_CHARPOS (row) + w->window_end_pos; ptrdiff_t Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; ptrdiff_t last_unchanged_pos, last_unchanged_pos_old; @@ -17133,7 +17124,7 @@ GIVE_UP (5); /* Another way to prevent redisplay optimizations. */ - if (XFASTINT (w->last_modified) == 0) + if (w->last_modified == 0) GIVE_UP (6); /* Verify that window is not hscrolled. */ @@ -17205,7 +17196,7 @@ This case happens with stealth-fontification. Note that although the display is unchanged, glyph positions in the matrix have to be adjusted, of course. */ - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + row = MATRIX_ROW (w->current_matrix, w->window_end_vpos); if (MATRIX_ROW_DISPLAYS_TEXT_P (row) && ((last_changed_charpos < CHARPOS (start) && CHARPOS (start) == BEGV) @@ -17217,7 +17208,7 @@ /* Compute how many chars/bytes have been added to or removed from the buffer. */ - Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); + Z_old = MATRIX_ROW_END_CHARPOS (row) + w->window_end_pos; Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; Z_delta = Z - Z_old; Z_delta_bytes = Z_BYTE - Z_BYTE_old; @@ -17288,8 +17279,7 @@ { /* We have to compute the window end anew since text could have been added/removed after it. */ - w->window_end_pos - = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (row); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); @@ -17324,7 +17314,7 @@ /* Give up if the window ends in strings. Overlay strings at the end are difficult to handle, so don't try. */ - row = MATRIX_ROW (current_matrix, XFASTINT (w->window_end_vpos)); + row = MATRIX_ROW (current_matrix, w->window_end_vpos); if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row)) GIVE_UP (20); @@ -17667,7 +17657,7 @@ /* Set last_row to the glyph row in the current matrix where the window end line is found. It has been moved up or down in the matrix by dvpos. */ - int last_vpos = XFASTINT (w->window_end_vpos) + dvpos; + int last_vpos = w->window_end_vpos + dvpos; struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos); /* If last_row is the window end line, it should display text. */ @@ -17723,21 +17713,18 @@ first_unchanged_at_end_row); xassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); - w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (row); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); - w->window_end_vpos - = make_number (MATRIX_ROW_VPOS (row, w->current_matrix)); + w->window_end_vpos = MATRIX_ROW_VPOS (row, w->current_matrix); xassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "A")); } else if (last_text_row_at_end) { - w->window_end_pos - = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end)); + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); - w->window_end_vpos - = make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix)); + w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix); xassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "B")); } @@ -17746,12 +17733,10 @@ /* We have displayed either to the end of the window or at the end of the window, i.e. the last row with text is to be found in the desired matrix. */ - w->window_end_pos - = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (last_text_row); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - w->window_end_vpos - = make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix)); + w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row, desired_matrix); xassert (w->window_end_bytepos >= 0); } else if (first_unchanged_at_end_row == NULL @@ -17761,7 +17746,7 @@ /* Displayed to end of window, but no line containing text was displayed. Lines were deleted at the end of the window. */ int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; - int vpos = XFASTINT (w->window_end_vpos); + int vpos = w->window_end_vpos; struct glyph_row *current_row = current_matrix->rows + vpos; struct glyph_row *desired_row = desired_matrix->rows + vpos; @@ -17779,8 +17764,8 @@ } xassert (row != NULL); - w->window_end_vpos = make_number (vpos + 1); - w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); + w->window_end_vpos = vpos + 1; + w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (row); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); xassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "C")); @@ -17788,8 +17773,8 @@ else abort (); - IF_DEBUG (debug_end_pos = XFASTINT (w->window_end_pos); - debug_end_vpos = XFASTINT (w->window_end_vpos)); + IF_DEBUG (debug_end_pos = w->window_end_pos; + debug_end_vpos = w->window_end_vpos); /* Record that display has not been completed. */ w->window_end_valid = Qnil; @@ -21408,7 +21393,7 @@ ptrdiff_t pos = marker_position (w->start); ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); - if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) + if (w->window_end_pos <= BUF_Z (b) - BUF_ZV (b)) { if (pos <= BUF_BEGV (b)) return "All"; @@ -21437,7 +21422,7 @@ case 'P': { ptrdiff_t toppos = marker_position (w->start); - ptrdiff_t botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); + ptrdiff_t botpos = BUF_Z (b) - w->window_end_pos; ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); if (botpos >= BUF_ZV (b)) @@ -26311,7 +26296,7 @@ /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2); if (r1 == NULL) - r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + r1 = MATRIX_ROW (w->current_matrix, w->window_end_vpos); /* If the before-string or display-string contains newlines, rows_from_pos_range skips to its last row. Move back. */ if (!NILP (before_string) || !NILP (disp_string)) @@ -26333,7 +26318,7 @@ } if (r2 == NULL) { - r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + r2 = MATRIX_ROW (w->current_matrix, w->window_end_vpos); hlinfo->mouse_face_past_end = 1; } else if (!NILP (after_string)) @@ -26341,7 +26326,7 @@ /* If the after-string has newlines, advance to its last row. */ struct glyph_row *next; struct glyph_row *last - = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + = MATRIX_ROW (w->current_matrix, w->window_end_vpos); for (next = r2 + 1; next <= last @@ -27410,8 +27395,8 @@ b = XBUFFER (w->buffer); if (part == ON_TEXT && EQ (w->window_end_valid, w->buffer) - && XFASTINT (w->last_modified) == BUF_MODIFF (b) - && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) + && w->last_modified == BUF_MODIFF (b) + && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b)) { int hpos, vpos, dx, dy, area = LAST_AREA; ptrdiff_t pos; @@ -27648,7 +27633,7 @@ Lisp_Object lim2 = NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) ? make_number (BUF_Z (XBUFFER (buffer)) - - XFASTINT (w->window_end_pos)) + - w->window_end_pos) : Qnil; if (NILP (overlay))