diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2013-02-11 14:21:52 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2013-02-11 14:21:52 +0400 |
commit | f74de3451c2cb3033f6d17f9c479150d00e4caa8 (patch) | |
tree | 71ae407b470ab3dfa954abd0279d363808618bd0 /src/window.c | |
parent | 5109429f09110cd817d87e1c361ac66aaee28431 (diff) | |
download | emacs-f74de3451c2cb3033f6d17f9c479150d00e4caa8.tar.gz emacs-f74de3451c2cb3033f6d17f9c479150d00e4caa8.tar.bz2 emacs-f74de3451c2cb3033f6d17f9c479150d00e4caa8.zip |
* marker.c (set_marker_internal): If desired position is passed
as a marker, avoid call to buf_charpos_to_bytepos.
* window.c (Fset_window_point): Omit redundant type checking.
(Fset_window_start): Likewise. Format comment.
(window_scroll_pixel_based): Use set_marker_restricted_both
with character and byte positions obtained from an iterator.
(Fset_window_configuration): Use set_marker_restricted_both.
* xdisp.c (message_dolog): Likewise.
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/window.c b/src/window.c index cc115c094f0..ea1dd93711c 100644 --- a/src/window.c +++ b/src/window.c @@ -1544,7 +1544,7 @@ Return POS. */) { register struct window *w = decode_live_window (window); - CHECK_NUMBER_COERCE_MARKER (pos); + /* Type of POS is checked by Fgoto_char or set_marker_restricted ... */ if (w == XWINDOW (selected_window)) { @@ -1554,6 +1554,8 @@ Return POS. */) { struct buffer *old_buffer = current_buffer; + /* ... but here we want to catch type error before buffer change. */ + CHECK_NUMBER_COERCE_MARKER (pos); set_buffer_internal (XBUFFER (w->buffer)); Fgoto_char (pos); set_buffer_internal (old_buffer); @@ -1579,9 +1581,8 @@ overriding motion of point in order to display at this exact start. */) { register struct window *w = decode_live_window (window); - CHECK_NUMBER_COERCE_MARKER (pos); set_marker_restricted (w->start, pos, w->buffer); - /* this is not right, but much easier than doing what is right. */ + /* This is not right, but much easier than doing what is right. */ w->start_at_line_beg = 0; if (NILP (noforce)) w->force_start = 1; @@ -4615,8 +4616,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) } /* Set the window start, and set up the window for redisplay. */ - set_marker_restricted (w->start, make_number (pos), - w->buffer); + set_marker_restricted_both (w->start, w->buffer, IT_CHARPOS (it), + IT_BYTEPOS (it)); bytepos = marker_byte_position (w->start); w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); w->update_mode_line = 1; @@ -5795,8 +5796,7 @@ the return value is nil. Otherwise the value is t. */) { /* Set window markers at start of visible range. */ if (XMARKER (w->start)->buffer == 0) - set_marker_restricted (w->start, make_number (0), - w->buffer); + set_marker_restricted_both (w->start, w->buffer, 0, 0); if (XMARKER (w->pointm)->buffer == 0) set_marker_restricted_both (w->pointm, w->buffer, @@ -5814,10 +5814,8 @@ the return value is nil. Otherwise the value is t. */) wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); /* This will set the markers to beginning of visible range. */ - set_marker_restricted (w->start, - make_number (0), w->buffer); - set_marker_restricted (w->pointm, - make_number (0), w->buffer); + set_marker_restricted_both (w->start, w->buffer, 0, 0); + set_marker_restricted_both (w->pointm, w->buffer, 0, 0); w->start_at_line_beg = 1; if (!NILP (w->dedicated)) /* Record this window as dead. */ |