aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov <[email protected]>2012-06-28 16:29:37 +0400
committerDmitry Antipov <[email protected]>2012-06-28 16:29:37 +0400
commit80b00b0885b8e124a208dfc9de95d2039a101108 (patch)
tree8954c62ff23338f8a2c6063cccab6d40d8707e02
parent62b2bcf611f144f4dea5a073a362e187970609f6 (diff)
* 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.
-rw-r--r--src/ChangeLog11
-rw-r--r--src/frame.c2
-rw-r--r--src/indent.c2
-rw-r--r--src/minibuf.c6
-rw-r--r--src/window.c81
-rw-r--r--src/window.h33
-rw-r--r--src/xdisp.c97
7 files changed, 123 insertions, 109 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 01a937d64f..7bb418fab5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2012-06-28 Dmitry Antipov <[email protected]>
+
+ * 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.
+
2012-06-28 Juanma Barranquero <[email protected]>
* makefile.w32-in ($(BLD)/regex.$(O)): Update dependencies.
diff --git a/src/frame.c b/src/frame.c
index f9a557f442..6ff336c40e 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -131,7 +131,7 @@ set_menu_bar_lines_1 (Lisp_Object window, int n)
{
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);
diff --git a/src/indent.c b/src/indent.c
index 88cc0ab479..ec0977d537 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1817,7 +1817,7 @@ static struct position val_vmotion;
struct position *
vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
{
- ptrdiff_t hscroll = XINT (w->hscroll);
+ ptrdiff_t hscroll = w->hscroll;
struct position pos;
/* vpos is cumulative vertical position, changed as from is changed */
register EMACS_INT vpos = 0;
diff --git a/src/minibuf.c b/src/minibuf.c
index b0f4e3db6c..7df230341d 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -622,7 +622,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
/* Display this minibuffer in the proper window. */
Fset_window_buffer (minibuf_window, Fcurrent_buffer (), Qnil);
Fselect_window (minibuf_window, Qnil);
- XSETFASTINT (XWINDOW (minibuf_window)->hscroll, 0);
+ XWINDOW (minibuf_window)->hscroll = 0;
Fmake_local_variable (Qprint_escape_newlines);
print_escape_newlines = 1;
@@ -888,8 +888,8 @@ read_minibuf_unwind (Lisp_Object data)
/* 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,
diff --git a/src/window.c b/src/window.c
index 55d6ac7a6e..4f3d40c51e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -667,7 +667,7 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
- return decode_window (window)->hscroll;
+ return make_number (decode_window (window)->hscroll);
}
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. */)
hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX);
/* Prevent redisplay shortcuts when changing the hscroll. */
- if (XINT (w->hscroll) != hscroll)
+ if (w->hscroll != hscroll)
XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
- w->hscroll = make_number (hscroll);
+ w->hscroll = hscroll;
return ncol;
}
@@ -1313,8 +1313,8 @@ if it isn't already recorded. */)
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;
@@ -1397,8 +1397,8 @@ overriding motion of point in order to display at this exact start. */)
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++;
@@ -1510,8 +1510,8 @@ Return nil if window display is not up-to-date. In that case, use
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))
@@ -3002,7 +3002,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
Resetting hscroll and vscroll here is problematic for things like
image-mode and doc-view-mode since it resets the image's position
whenever we resize the frame. */
- w->hscroll = w->min_hscroll = make_number (0);
+ w->hscroll = w->min_hscroll = 0;
w->vscroll = 0;
set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b));
set_marker_restricted (w->start,
@@ -3010,8 +3010,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
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. */
@@ -3196,8 +3196,8 @@ temp_output_buffer_show (register Lisp_Object buf)
Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
Vminibuf_scroll_window = window;
w = XWINDOW (window);
- XSETFASTINT (w->hscroll, 0);
- XSETFASTINT (w->min_hscroll, 0);
+ w->hscroll = 0;
+ w->min_hscroll = 0;
set_marker_restricted_both (w->start, buf, BEG, BEG);
set_marker_restricted_both (w->pointm, buf, BEG, BEG);
@@ -3286,9 +3286,6 @@ make_window (void)
XSETFASTINT (w->new_normal, 0);
w->start = Fmake_marker ();
w->pointm = Fmake_marker ();
- XSETFASTINT (w->hscroll, 0);
- XSETFASTINT (w->min_hscroll, 0);
- XSETFASTINT (w->last_point, 0);
w->vertical_scroll_bar_type = Qt;
XSETFASTINT (w->window_end_pos, 0);
XSETFASTINT (w->window_end_vpos, 0);
@@ -3488,8 +3485,8 @@ window_resize_apply (struct window *w, int horflag)
}
/* 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;
}
@@ -4021,8 +4018,8 @@ grow_mini_window (struct window *w, int delta)
/* 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;
@@ -4057,8 +4054,8 @@ shrink_mini_window (struct window *w)
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;
@@ -4285,8 +4282,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
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;
@@ -4431,8 +4428,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
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;
@@ -4585,10 +4582,10 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
struct position posit
= *compute_motion (startpos, 0, 0, 0,
PT, ht, 0,
- -1, XINT (w->hscroll),
+ -1, w->hscroll,
0, w);
window_scroll_preserve_vpos = posit.vpos;
- window_scroll_preserve_hpos = posit.hpos + XINT (w->hscroll);
+ window_scroll_preserve_hpos = posit.hpos + w->hscroll;
}
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)
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;
@@ -4872,7 +4869,7 @@ by this function. This happens in an interactive call. */)
(register Lisp_Object arg, Lisp_Object set_minimum)
{
Lisp_Object result;
- EMACS_INT hscroll;
+ ptrdiff_t hscroll;
struct window *w = XWINDOW (selected_window);
if (NILP (arg))
@@ -4880,7 +4877,7 @@ by this function. This happens in an interactive call. */)
else
arg = Fprefix_numeric_value (arg);
- hscroll = XINT (w->hscroll) + XINT (arg);
+ hscroll = w->hscroll + XINT (arg);
result = Fset_window_hscroll (selected_window, make_number (hscroll));
if (!NILP (set_minimum))
@@ -4901,7 +4898,7 @@ by this function. This happens in an interactive call. */)
(register Lisp_Object arg, Lisp_Object set_minimum)
{
Lisp_Object result;
- EMACS_INT hscroll;
+ ptrdiff_t hscroll;
struct window *w = XWINDOW (selected_window);
if (NILP (arg))
@@ -4909,7 +4906,7 @@ by this function. This happens in an interactive call. */)
else
arg = Fprefix_numeric_value (arg);
- hscroll = XINT (w->hscroll) - XINT (arg);
+ hscroll = w->hscroll - XINT (arg);
result = Fset_window_hscroll (selected_window, make_number (hscroll));
if (!NILP (set_minimum))
@@ -5537,8 +5534,8 @@ the return value is nil. Otherwise the value is t. */)
w->total_lines = p->total_lines;
w->normal_cols = p->normal_cols;
w->normal_lines = p->normal_lines;
- w->hscroll = p->hscroll;
- w->min_hscroll = p->min_hscroll;
+ w->hscroll = XFASTINT (p->hscroll);
+ w->min_hscroll = XFASTINT (p->min_hscroll);
w->display_table = p->display_table;
w->left_margin_cols = p->left_margin_cols;
w->right_margin_cols = p->right_margin_cols;
@@ -5571,8 +5568,8 @@ the return value is nil. Otherwise the value is t. */)
}
}
- 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))
@@ -5811,7 +5808,7 @@ get_phys_cursor_glyph (struct window *w)
if (!row->enabled_p)
return NULL;
- if (XINT (w->hscroll))
+ if (w->hscroll)
{
/* When the window is hscrolled, cursor hpos can legitimately be
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)
p->total_lines = w->total_lines;
p->normal_cols = w->normal_cols;
p->normal_lines = w->normal_lines;
- p->hscroll = w->hscroll;
- p->min_hscroll = w->min_hscroll;
+ XSETFASTINT (p->hscroll, w->hscroll);
+ XSETFASTINT (p->min_hscroll, w->min_hscroll);
p->display_table = w->display_table;
p->left_margin_cols = w->left_margin_cols;
p->right_margin_cols = w->right_margin_cols;
diff --git a/src/window.h b/src/window.h
index 996c966b05..50bd7134f2 100644
--- a/src/window.h
+++ b/src/window.h
@@ -141,24 +141,10 @@ struct window
each one can have its own value of point. */
Lisp_Object pointm;
- /* Number of columns display within the window is scrolled to the left. */
- Lisp_Object hscroll;
- /* Minimum hscroll for automatic hscrolling. This is the value
- the user has set, by set-window-hscroll for example. */
- Lisp_Object min_hscroll;
-
/* 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
@@ -254,6 +240,25 @@ struct window
/* Unique number of window assigned when it was created. */
int sequence_number;
+ /* Number of columns display within the window is scrolled to the left. */
+ ptrdiff_t hscroll;
+
+ /* Minimum hscroll for automatic hscrolling. This is the value
+ the user has set, by set-window-hscroll for example. */
+ ptrdiff_t min_hscroll;
+
+ /* 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. Since this is a position in a buffer,
+ it should be positive. */
+ ptrdiff_t last_point;
+
/* 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. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 425ccc522d..ae06355ac6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1562,8 +1562,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
current_header_line_height = current_mode_line_height = -1;
- if (visible_p && XFASTINT (w->hscroll) > 0)
- *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w);
+ if (visible_p && w->hscroll > 0)
+ *x -= w->hscroll * WINDOW_FRAME_COLUMN_WIDTH (w);
#if 0
/* Debugging code. */
@@ -2697,7 +2697,7 @@ init_iterator (struct it *it, struct window *w,
/* Are lines in the display truncated? */
if (base_face_id != DEFAULT_FACE_ID
- || XINT (it->w->hscroll)
+ || it->w->hscroll
|| (! WINDOW_FULL_WIDTH_P (it->w)
&& ((!NILP (Vtruncate_partial_width_windows)
&& !INTEGERP (Vtruncate_partial_width_windows))
@@ -2760,7 +2760,7 @@ init_iterator (struct it *it, struct window *w,
else
{
it->first_visible_x
- = XFASTINT (it->w->hscroll) * FRAME_COLUMN_WIDTH (it->f);
+ = it->w->hscroll * FRAME_COLUMN_WIDTH (it->f);
it->last_visible_x = (it->first_visible_x
+ window_box_width (w, TEXT_AREA));
@@ -12309,7 +12309,7 @@ hscroll_window_tree (Lisp_Object window)
inside the left margin and the window is already
hscrolled. */
&& ((!row_r2l_p
- && ((XFASTINT (w->hscroll)
+ && ((w->hscroll
&& w->cursor.x <= h_margin)
|| (cursor_row->enabled_p
&& cursor_row->truncated_on_right_p
@@ -12327,7 +12327,7 @@ hscroll_window_tree (Lisp_Object window)
are actually truncated on the left. */
&& cursor_row->truncated_on_right_p
&& w->cursor.x <= h_margin)
- || (XFASTINT (w->hscroll)
+ || (w->hscroll
&& (w->cursor.x >= text_area_width - h_margin))))))
{
struct it it;
@@ -12388,15 +12388,15 @@ hscroll_window_tree (Lisp_Object window)
hscroll
= max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
}
- hscroll = max (hscroll, XFASTINT (w->min_hscroll));
+ hscroll = max (hscroll, w->min_hscroll);
/* Don't prevent redisplay optimizations if hscroll
hasn't changed, as it will unnecessarily slow down
redisplay. */
- if (XFASTINT (w->hscroll) != hscroll)
+ if (w->hscroll != hscroll)
{
XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
- w->hscroll = make_number (hscroll);
+ w->hscroll = hscroll;
hscrolled_p = 1;
}
}
@@ -12508,8 +12508,8 @@ text_outside_line_unchanged_p (struct window *w,
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 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
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 @@ redisplay_internal (void)
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 @@ redisplay_internal (void)
}
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 @@ redisplay_internal (void)
|| 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
@@ -13248,7 +13248,7 @@ redisplay_internal (void)
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 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
{
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 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
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 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
return rc;
#endif
+ /* Previously, there was a check for Lisp integer in the
+ if-statement below. Now, this field is converted to
+ ptrdiff_t, thus 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 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
&& !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
@@ -15011,7 +15012,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
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 +15047,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
&& !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. */
@@ -15392,8 +15393,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
= (!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 +15416,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
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 +15442,9 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
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 +15560,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
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 +15686,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
&& (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 +15774,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
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)
@@ -17133,11 +17134,11 @@ try_window_id (struct window *w)
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. */
- if (XFASTINT (w->hscroll) != 0)
+ if (w->hscroll != 0)
GIVE_UP (7);
/* Verify that display wasn't paused. */
@@ -27410,8 +27411,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
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;