aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-12-11 10:08:53 +0400
committerDmitry Antipov2012-12-11 10:08:53 +0400
commit4c1acb95dffa5948c7534911c07c2c3d8f390b79 (patch)
tree28e63a4c2296b9dfc8d061a658196d60d5376c56 /src/window.c
parent36327e4ffc03cc71d15be5fc381a08ec082bf60c (diff)
downloademacs-4c1acb95dffa5948c7534911c07c2c3d8f390b79.tar.gz
emacs-4c1acb95dffa5948c7534911c07c2c3d8f390b79.zip
Consistently use marker_position and marker_byte_position.
* fringe.c (Ffringe_bitmaps_at_pos): * indent.c (Fvertical_motion): * insdel.c (prepare_to_modify_buffer): * keyboard.c (make_lispy_position): * window.c (Fwindow_end, Fpos_visible_in_window_p, unshow_buffer) (window_scroll_pixel_based, displayed_window_lines) (Fset_window_configuration): * xdisp.c (message_dolog, with_echo_area_buffer_unwind_data) (mark_window_display_accurate_1, redisplay_window, decode_mode_spec): Replace direct access to marker fields with calls to marker_position and/or marker_byte_position.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c
index 9d593b6d36e..17489cb95e9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1492,6 +1492,7 @@ if it isn't already recorded. */)
1492 && !noninteractive) 1492 && !noninteractive)
1493 { 1493 {
1494 struct text_pos startp; 1494 struct text_pos startp;
1495 ptrdiff_t charpos = marker_position (w->start);
1495 struct it it; 1496 struct it it;
1496 struct buffer *old_buffer = NULL; 1497 struct buffer *old_buffer = NULL;
1497 void *itdata = NULL; 1498 void *itdata = NULL;
@@ -1509,9 +1510,9 @@ if it isn't already recorded. */)
1509 `-l' containing a call to `rmail' with subsequent other 1510 `-l' containing a call to `rmail' with subsequent other
1510 commands. At the end, W->start happened to be BEG, while 1511 commands. At the end, W->start happened to be BEG, while
1511 rmail had already narrowed the buffer. */ 1512 rmail had already narrowed the buffer. */
1512 if (XMARKER (w->start)->charpos < BEGV) 1513 if (charpos < BEGV)
1513 SET_TEXT_POS (startp, BEGV, BEGV_BYTE); 1514 SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
1514 else if (XMARKER (w->start)->charpos > ZV) 1515 else if (charpos > ZV)
1515 SET_TEXT_POS (startp, ZV, ZV_BYTE); 1516 SET_TEXT_POS (startp, ZV, ZV_BYTE);
1516 else 1517 else
1517 SET_TEXT_POS_FROM_MARKER (startp, w->start); 1518 SET_TEXT_POS_FROM_MARKER (startp, w->start);
@@ -1634,7 +1635,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1634 else if (w == XWINDOW (selected_window)) 1635 else if (w == XWINDOW (selected_window))
1635 posint = PT; 1636 posint = PT;
1636 else 1637 else
1637 posint = XMARKER (w->pointm)->charpos; 1638 posint = marker_position (w->pointm);
1638 1639
1639 /* If position is above window start or outside buffer boundaries, 1640 /* If position is above window start or outside buffer boundaries,
1640 or if window start is out of range, position is not visible. */ 1641 or if window start is out of range, position is not visible. */
@@ -1980,7 +1981,7 @@ unshow_buffer (register struct window *w)
1980 && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer))) 1981 && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer)))
1981 temp_set_point_both (b, 1982 temp_set_point_both (b,
1982 clip_to_bounds (BUF_BEGV (b), 1983 clip_to_bounds (BUF_BEGV (b),
1983 XMARKER (w->pointm)->charpos, 1984 marker_position (w->pointm),
1984 BUF_ZV (b)), 1985 BUF_ZV (b)),
1985 clip_to_bounds (BUF_BEGV_BYTE (b), 1986 clip_to_bounds (BUF_BEGV_BYTE (b),
1986 marker_byte_position (w->pointm), 1987 marker_byte_position (w->pointm),
@@ -4616,7 +4617,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4616 /* Set the window start, and set up the window for redisplay. */ 4617 /* Set the window start, and set up the window for redisplay. */
4617 set_marker_restricted (w->start, make_number (pos), 4618 set_marker_restricted (w->start, make_number (pos),
4618 w->buffer); 4619 w->buffer);
4619 bytepos = XMARKER (w->start)->bytepos; 4620 bytepos = marker_byte_position (w->start);
4620 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); 4621 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
4621 w->update_mode_line = 1; 4622 w->update_mode_line = 1;
4622 w->last_modified = 0; 4623 w->last_modified = 0;
@@ -5116,6 +5117,7 @@ displayed_window_lines (struct window *w)
5116{ 5117{
5117 struct it it; 5118 struct it it;
5118 struct text_pos start; 5119 struct text_pos start;
5120 ptrdiff_t charpos = marker_position (w->start);
5119 int height = window_box_height (w); 5121 int height = window_box_height (w);
5120 struct buffer *old_buffer; 5122 struct buffer *old_buffer;
5121 int bottom_y; 5123 int bottom_y;
@@ -5132,9 +5134,9 @@ displayed_window_lines (struct window *w)
5132 /* In case W->start is out of the accessible range, do something 5134 /* In case W->start is out of the accessible range, do something
5133 reasonable. This happens in Info mode when Info-scroll-down 5135 reasonable. This happens in Info mode when Info-scroll-down
5134 calls (recenter -1) while W->start is 1. */ 5136 calls (recenter -1) while W->start is 1. */
5135 if (XMARKER (w->start)->charpos < BEGV) 5137 if (charpos < BEGV)
5136 SET_TEXT_POS (start, BEGV, BEGV_BYTE); 5138 SET_TEXT_POS (start, BEGV, BEGV_BYTE);
5137 else if (XMARKER (w->start)->charpos > ZV) 5139 else if (charpos > ZV)
5138 SET_TEXT_POS (start, ZV, ZV_BYTE); 5140 SET_TEXT_POS (start, ZV, ZV_BYTE);
5139 else 5141 else
5140 SET_TEXT_POS_FROM_MARKER (start, w->start); 5142 SET_TEXT_POS_FROM_MARKER (start, w->start);
@@ -5562,7 +5564,7 @@ the return value is nil. Otherwise the value is t. */)
5562 && WINDOWP (selected_window) 5564 && WINDOWP (selected_window)
5563 && EQ (XWINDOW (selected_window)->buffer, new_current_buffer) 5565 && EQ (XWINDOW (selected_window)->buffer, new_current_buffer)
5564 && !EQ (selected_window, data->current_window)) 5566 && !EQ (selected_window, data->current_window))
5565 old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos; 5567 old_point = marker_position (XWINDOW (data->current_window)->pointm);
5566 else 5568 else
5567 old_point = PT; 5569 old_point = PT;
5568 else 5570 else
@@ -5577,7 +5579,7 @@ the return value is nil. Otherwise the value is t. */)
5577 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) 5579 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)
5578 /* If current_window = selected_window, its point is in BUF_PT. */ 5580 /* If current_window = selected_window, its point is in BUF_PT. */
5579 && !EQ (selected_window, data->current_window)) 5581 && !EQ (selected_window, data->current_window))
5580 old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos; 5582 old_point = marker_position (XWINDOW (data->current_window)->pointm);
5581 else 5583 else
5582 old_point = BUF_PT (XBUFFER (new_current_buffer)); 5584 old_point = BUF_PT (XBUFFER (new_current_buffer));
5583 } 5585 }