diff options
| author | Dmitry Antipov | 2013-02-11 14:21:52 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 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.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. */) | |||
| 1544 | { | 1544 | { |
| 1545 | register struct window *w = decode_live_window (window); | 1545 | register struct window *w = decode_live_window (window); |
| 1546 | 1546 | ||
| 1547 | CHECK_NUMBER_COERCE_MARKER (pos); | 1547 | /* Type of POS is checked by Fgoto_char or set_marker_restricted ... */ |
| 1548 | 1548 | ||
| 1549 | if (w == XWINDOW (selected_window)) | 1549 | if (w == XWINDOW (selected_window)) |
| 1550 | { | 1550 | { |
| @@ -1554,6 +1554,8 @@ Return POS. */) | |||
| 1554 | { | 1554 | { |
| 1555 | struct buffer *old_buffer = current_buffer; | 1555 | struct buffer *old_buffer = current_buffer; |
| 1556 | 1556 | ||
| 1557 | /* ... but here we want to catch type error before buffer change. */ | ||
| 1558 | CHECK_NUMBER_COERCE_MARKER (pos); | ||
| 1557 | set_buffer_internal (XBUFFER (w->buffer)); | 1559 | set_buffer_internal (XBUFFER (w->buffer)); |
| 1558 | Fgoto_char (pos); | 1560 | Fgoto_char (pos); |
| 1559 | set_buffer_internal (old_buffer); | 1561 | set_buffer_internal (old_buffer); |
| @@ -1579,9 +1581,8 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1579 | { | 1581 | { |
| 1580 | register struct window *w = decode_live_window (window); | 1582 | register struct window *w = decode_live_window (window); |
| 1581 | 1583 | ||
| 1582 | CHECK_NUMBER_COERCE_MARKER (pos); | ||
| 1583 | set_marker_restricted (w->start, pos, w->buffer); | 1584 | set_marker_restricted (w->start, pos, w->buffer); |
| 1584 | /* this is not right, but much easier than doing what is right. */ | 1585 | /* This is not right, but much easier than doing what is right. */ |
| 1585 | w->start_at_line_beg = 0; | 1586 | w->start_at_line_beg = 0; |
| 1586 | if (NILP (noforce)) | 1587 | if (NILP (noforce)) |
| 1587 | w->force_start = 1; | 1588 | w->force_start = 1; |
| @@ -4615,8 +4616,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4615 | } | 4616 | } |
| 4616 | 4617 | ||
| 4617 | /* Set the window start, and set up the window for redisplay. */ | 4618 | /* Set the window start, and set up the window for redisplay. */ |
| 4618 | set_marker_restricted (w->start, make_number (pos), | 4619 | set_marker_restricted_both (w->start, w->buffer, IT_CHARPOS (it), |
| 4619 | w->buffer); | 4620 | IT_BYTEPOS (it)); |
| 4620 | bytepos = marker_byte_position (w->start); | 4621 | bytepos = marker_byte_position (w->start); |
| 4621 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); | 4622 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); |
| 4622 | w->update_mode_line = 1; | 4623 | w->update_mode_line = 1; |
| @@ -5795,8 +5796,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5795 | { | 5796 | { |
| 5796 | /* Set window markers at start of visible range. */ | 5797 | /* Set window markers at start of visible range. */ |
| 5797 | if (XMARKER (w->start)->buffer == 0) | 5798 | if (XMARKER (w->start)->buffer == 0) |
| 5798 | set_marker_restricted (w->start, make_number (0), | 5799 | set_marker_restricted_both (w->start, w->buffer, 0, 0); |
| 5799 | w->buffer); | ||
| 5800 | if (XMARKER (w->pointm)->buffer == 0) | 5800 | if (XMARKER (w->pointm)->buffer == 0) |
| 5801 | set_marker_restricted_both | 5801 | set_marker_restricted_both |
| 5802 | (w->pointm, w->buffer, | 5802 | (w->pointm, w->buffer, |
| @@ -5814,10 +5814,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5814 | wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); | 5814 | wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); |
| 5815 | /* This will set the markers to beginning of visible | 5815 | /* This will set the markers to beginning of visible |
| 5816 | range. */ | 5816 | range. */ |
| 5817 | set_marker_restricted (w->start, | 5817 | set_marker_restricted_both (w->start, w->buffer, 0, 0); |
| 5818 | make_number (0), w->buffer); | 5818 | set_marker_restricted_both (w->pointm, w->buffer, 0, 0); |
| 5819 | set_marker_restricted (w->pointm, | ||
| 5820 | make_number (0), w->buffer); | ||
| 5821 | w->start_at_line_beg = 1; | 5819 | w->start_at_line_beg = 1; |
| 5822 | if (!NILP (w->dedicated)) | 5820 | if (!NILP (w->dedicated)) |
| 5823 | /* Record this window as dead. */ | 5821 | /* Record this window as dead. */ |