aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/fringe.c2
-rw-r--r--src/indent.c4
-rw-r--r--src/insdel.c2
-rw-r--r--src/keyboard.c2
-rw-r--r--src/window.c20
-rw-r--r--src/xdisp.c18
7 files changed, 40 insertions, 23 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0474cf67e16..631425552f8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12012-12-11 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Consistently use marker_position and marker_byte_position.
4 * fringe.c (Ffringe_bitmaps_at_pos):
5 * indent.c (Fvertical_motion):
6 * insdel.c (prepare_to_modify_buffer):
7 * keyboard.c (make_lispy_position):
8 * window.c (Fwindow_end, Fpos_visible_in_window_p, unshow_buffer)
9 (window_scroll_pixel_based, displayed_window_lines)
10 (Fset_window_configuration):
11 * xdisp.c (message_dolog, with_echo_area_buffer_unwind_data)
12 (mark_window_display_accurate_1, redisplay_window, decode_mode_spec):
13 Replace direct access to marker fields with calls
14 to marker_position and/or marker_byte_position.
15
12012-12-11 Juanma Barranquero <lekktu@gmail.com> 162012-12-11 Juanma Barranquero <lekktu@gmail.com>
2 17
3 * makefile.w32-in (SIG2STR_H): New macro. 18 * makefile.w32-in (SIG2STR_H): New macro.
diff --git a/src/fringe.c b/src/fringe.c
index a126292e1ff..ce31fd01763 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1744,7 +1744,7 @@ Return nil if POS is not visible in WINDOW. */)
1744 else if (w == XWINDOW (selected_window)) 1744 else if (w == XWINDOW (selected_window))
1745 textpos = PT; 1745 textpos = PT;
1746 else 1746 else
1747 textpos = XMARKER (w->pointm)->charpos; 1747 textpos = marker_position (w->pointm);
1748 1748
1749 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 1749 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
1750 row = row_containing_pos (w, textpos, row, NULL, 0); 1750 row = row_containing_pos (w, textpos, row, NULL, 0);
diff --git a/src/indent.c b/src/indent.c
index 327526eae2d..3dbf372cf17 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1991,8 +1991,8 @@ whether or not it is currently displayed in some window. */)
1991 { 1991 {
1992 /* Set the window's buffer temporarily to the current buffer. */ 1992 /* Set the window's buffer temporarily to the current buffer. */
1993 old_buffer = w->buffer; 1993 old_buffer = w->buffer;
1994 old_charpos = XMARKER (w->pointm)->charpos; 1994 old_charpos = marker_position (w->pointm);
1995 old_bytepos = XMARKER (w->pointm)->bytepos; 1995 old_bytepos = marker_byte_position (w->pointm);
1996 wset_buffer (w, Fcurrent_buffer ()); 1996 wset_buffer (w, Fcurrent_buffer ());
1997 set_marker_both (w->pointm, w->buffer, 1997 set_marker_both (w->pointm, w->buffer,
1998 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); 1998 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
diff --git a/src/insdel.c b/src/insdel.c
index 892ca3d5216..5803a48e949 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1854,7 +1854,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1854 : (!NILP (Vselect_active_regions) 1854 : (!NILP (Vselect_active_regions)
1855 && !NILP (Vtransient_mark_mode)))) 1855 && !NILP (Vtransient_mark_mode))))
1856 { 1856 {
1857 ptrdiff_t b = XMARKER (BVAR (current_buffer, mark))->charpos; 1857 ptrdiff_t b = marker_position (BVAR (current_buffer, mark));
1858 ptrdiff_t e = PT; 1858 ptrdiff_t e = PT;
1859 if (b < e) 1859 if (b < e)
1860 Vsaved_region_selection = make_buffer_string (b, e, 0); 1860 Vsaved_region_selection = make_buffer_string (b, e, 0);
diff --git a/src/keyboard.c b/src/keyboard.c
index e3dcb8a438e..e2a0e23dd4a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5138,7 +5138,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5138 string_info = Fcons (string, make_number (charpos)); 5138 string_info = Fcons (string, make_number (charpos));
5139 textpos = (w == XWINDOW (selected_window) 5139 textpos = (w == XWINDOW (selected_window)
5140 && current_buffer == XBUFFER (w->buffer)) 5140 && current_buffer == XBUFFER (w->buffer))
5141 ? PT : XMARKER (w->pointm)->charpos; 5141 ? PT : marker_position (w->pointm);
5142 5142
5143 xret = wx; 5143 xret = wx;
5144 yret = wy; 5144 yret = wy;
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 }
diff --git a/src/xdisp.c b/src/xdisp.c
index cf0424ede17..d9f40130d66 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9495,7 +9495,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
9495 del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, 0); 9495 del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, 0);
9496 } 9496 }
9497 } 9497 }
9498 BEGV = XMARKER (oldbegv)->charpos; 9498 BEGV = marker_position (oldbegv);
9499 BEGV_BYTE = marker_byte_position (oldbegv); 9499 BEGV_BYTE = marker_byte_position (oldbegv);
9500 9500
9501 if (zv_at_end) 9501 if (zv_at_end)
@@ -9505,7 +9505,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
9505 } 9505 }
9506 else 9506 else
9507 { 9507 {
9508 ZV = XMARKER (oldzv)->charpos; 9508 ZV = marker_position (oldzv);
9509 ZV_BYTE = marker_byte_position (oldzv); 9509 ZV_BYTE = marker_byte_position (oldzv);
9510 } 9510 }
9511 9511
@@ -9514,8 +9514,8 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
9514 else 9514 else
9515 /* We can't do Fgoto_char (oldpoint) because it will run some 9515 /* We can't do Fgoto_char (oldpoint) because it will run some
9516 Lisp code. */ 9516 Lisp code. */
9517 TEMP_SET_PT_BOTH (XMARKER (oldpoint)->charpos, 9517 TEMP_SET_PT_BOTH (marker_position (oldpoint),
9518 XMARKER (oldpoint)->bytepos); 9518 marker_byte_position (oldpoint));
9519 9519
9520 UNGCPRO; 9520 UNGCPRO;
9521 unchain_marker (XMARKER (oldpoint)); 9521 unchain_marker (XMARKER (oldpoint));
@@ -10087,8 +10087,8 @@ with_echo_area_buffer_unwind_data (struct window *w)
10087 { 10087 {
10088 XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i; 10088 XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i;
10089 ASET (vector, i, w->buffer); ++i; 10089 ASET (vector, i, w->buffer); ++i;
10090 ASET (vector, i, make_number (XMARKER (w->pointm)->charpos)); ++i; 10090 ASET (vector, i, make_number (marker_position (w->pointm))); ++i;
10091 ASET (vector, i, make_number (XMARKER (w->pointm)->bytepos)); ++i; 10091 ASET (vector, i, make_number (marker_byte_position (w->pointm))); ++i;
10092 } 10092 }
10093 else 10093 else
10094 { 10094 {
@@ -13801,7 +13801,7 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
13801 if (w == XWINDOW (selected_window)) 13801 if (w == XWINDOW (selected_window))
13802 w->last_point = BUF_PT (b); 13802 w->last_point = BUF_PT (b);
13803 else 13803 else
13804 w->last_point = XMARKER (w->pointm)->charpos; 13804 w->last_point = marker_position (w->pointm);
13805 } 13805 }
13806 } 13806 }
13807 13807
@@ -15562,7 +15562,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15562 window, set up appropriate value. */ 15562 window, set up appropriate value. */
15563 if (!EQ (window, selected_window)) 15563 if (!EQ (window, selected_window))
15564 { 15564 {
15565 ptrdiff_t new_pt = XMARKER (w->pointm)->charpos; 15565 ptrdiff_t new_pt = marker_position (w->pointm);
15566 ptrdiff_t new_pt_byte = marker_byte_position (w->pointm); 15566 ptrdiff_t new_pt_byte = marker_byte_position (w->pointm);
15567 if (new_pt < BEGV) 15567 if (new_pt < BEGV)
15568 { 15568 {
@@ -21526,7 +21526,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21526 if (mode_line_target == MODE_LINE_TITLE) 21526 if (mode_line_target == MODE_LINE_TITLE)
21527 return ""; 21527 return "";
21528 21528
21529 startpos = XMARKER (w->start)->charpos; 21529 startpos = marker_position (w->start);
21530 startpos_byte = marker_byte_position (w->start); 21530 startpos_byte = marker_byte_position (w->start);
21531 height = WINDOW_TOTAL_LINES (w); 21531 height = WINDOW_TOTAL_LINES (w);
21532 21532