0, false, false);
}
+ptrdiff_t
+window_point (struct window *w)
+{
+ return (w == XWINDOW (selected_window)
+ ? BUF_PT (XBUFFER (w->contents))
+ : XMARKER (w->pointm)->charpos);
+}
+
DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,
doc: /* Return current value of point in WINDOW.
WINDOW must be a live window and defaults to the selected one.
`save-excursion' forms. But that is hard to define. */)
(Lisp_Object window)
{
- register struct window *w = decode_live_window (window);
-
- if (w == XWINDOW (selected_window))
- return make_fixnum (BUF_PT (XBUFFER (w->contents)));
- else
- return Fmarker_position (w->pointm);
+ return make_fixnum (window_point (decode_live_window (window)));
}
DEFUN ("window-old-point", Fwindow_old_point, Swindow_old_point, 0, 1, 0,
/* This looks like a setter, but it is a bit special. */
extern void wset_buffer (struct window *, Lisp_Object);
extern bool window_outdated (struct window *);
+extern ptrdiff_t window_point (struct window *w);
extern void init_window_once (void);
extern void init_window (void);
extern void syms_of_window (void);
&& (update_mode_lines == 0 \
|| update_mode_lines == REDISPLAY_SOME))
+static bool
+needs_no_redisplay (struct window *w)
+{
+ struct buffer *buffer = XBUFFER (w->contents);
+ struct frame *f = XFRAME (w->frame);
+ return (REDISPLAY_SOME_P ()
+ && !w->redisplay
+ && !w->update_mode_line
+ && !f->face_change
+ && !f->redisplay
+ && !buffer->text->redisplay
+ && window_point (w) == w->last_point);
+}
+
/* Prepare for redisplay by updating menu-bar item lists when
appropriate. This can call eval. */
struct window *w = XWINDOW (this);
/* Cf. conditions for redisplaying a window at the
beginning of redisplay_window. */
- if (w->redisplay
- || XFRAME (w->frame)->redisplay
- || XBUFFER (w->contents)->text->redisplay
- || BUF_PT (XBUFFER (w->contents)) != w->last_point)
- {
- windows = Fcons (this, windows);
- }
+ if (!needs_no_redisplay (w))
+ windows = Fcons (this, windows);
}
}
safe__call1 (true, Vpre_redisplay_function, windows);
*w->desired_matrix->method = 0;
#endif
- if (!just_this_one_p
- && REDISPLAY_SOME_P ()
- && !w->redisplay
- && !w->update_mode_line
- && !f->face_change
- && !f->redisplay
- && !buffer->text->redisplay
- && BUF_PT (buffer) == w->last_point)
+ if (!just_this_one_p && needs_no_redisplay (w))
return;
/* Make sure that both W's markers are valid. */