summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
+2012-12-11 Dmitry Antipov <dmantipov@yandex.ru>
+
+ 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.
+
2012-12-11 Juanma Barranquero <lekktu@gmail.com>
* 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. */)
else if (w == XWINDOW (selected_window))
textpos = PT;
else
- textpos = XMARKER (w->pointm)->charpos;
+ textpos = marker_position (w->pointm);
row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
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. */)
{
/* Set the window's buffer temporarily to the current buffer. */
old_buffer = w->buffer;
- old_charpos = XMARKER (w->pointm)->charpos;
- old_bytepos = XMARKER (w->pointm)->bytepos;
+ old_charpos = marker_position (w->pointm);
+ old_bytepos = marker_byte_position (w->pointm);
wset_buffer (w, Fcurrent_buffer ());
set_marker_both (w->pointm, w->buffer,
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,
: (!NILP (Vselect_active_regions)
&& !NILP (Vtransient_mark_mode))))
{
- ptrdiff_t b = XMARKER (BVAR (current_buffer, mark))->charpos;
+ ptrdiff_t b = marker_position (BVAR (current_buffer, mark));
ptrdiff_t e = PT;
if (b < e)
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,
string_info = Fcons (string, make_number (charpos));
textpos = (w == XWINDOW (selected_window)
&& current_buffer == XBUFFER (w->buffer))
- ? PT : XMARKER (w->pointm)->charpos;
+ ? PT : marker_position (w->pointm);
xret = wx;
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. */)
&& !noninteractive)
{
struct text_pos startp;
+ ptrdiff_t charpos = marker_position (w->start);
struct it it;
struct buffer *old_buffer = NULL;
void *itdata = NULL;
@@ -1509,9 +1510,9 @@ if it isn't already recorded. */)
`-l' containing a call to `rmail' with subsequent other
commands. At the end, W->start happened to be BEG, while
rmail had already narrowed the buffer. */
- if (XMARKER (w->start)->charpos < BEGV)
+ if (charpos < BEGV)
SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
- else if (XMARKER (w->start)->charpos > ZV)
+ else if (charpos > ZV)
SET_TEXT_POS (startp, ZV, ZV_BYTE);
else
SET_TEXT_POS_FROM_MARKER (startp, w->start);
@@ -1634,7 +1635,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
else if (w == XWINDOW (selected_window))
posint = PT;
else
- posint = XMARKER (w->pointm)->charpos;
+ posint = marker_position (w->pointm);
/* If position is above window start or outside buffer boundaries,
or if window start is out of range, position is not visible. */
@@ -1980,7 +1981,7 @@ unshow_buffer (register struct window *w)
&& EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer)))
temp_set_point_both (b,
clip_to_bounds (BUF_BEGV (b),
- XMARKER (w->pointm)->charpos,
+ marker_position (w->pointm),
BUF_ZV (b)),
clip_to_bounds (BUF_BEGV_BYTE (b),
marker_byte_position (w->pointm),
@@ -4616,7 +4617,7 @@ 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);
- bytepos = XMARKER (w->start)->bytepos;
+ bytepos = marker_byte_position (w->start);
w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
w->update_mode_line = 1;
w->last_modified = 0;
@@ -5116,6 +5117,7 @@ displayed_window_lines (struct window *w)
{
struct it it;
struct text_pos start;
+ ptrdiff_t charpos = marker_position (w->start);
int height = window_box_height (w);
struct buffer *old_buffer;
int bottom_y;
@@ -5132,9 +5134,9 @@ displayed_window_lines (struct window *w)
/* In case W->start is out of the accessible range, do something
reasonable. This happens in Info mode when Info-scroll-down
calls (recenter -1) while W->start is 1. */
- if (XMARKER (w->start)->charpos < BEGV)
+ if (charpos < BEGV)
SET_TEXT_POS (start, BEGV, BEGV_BYTE);
- else if (XMARKER (w->start)->charpos > ZV)
+ else if (charpos > ZV)
SET_TEXT_POS (start, ZV, ZV_BYTE);
else
SET_TEXT_POS_FROM_MARKER (start, w->start);
@@ -5562,7 +5564,7 @@ the return value is nil. Otherwise the value is t. */)
&& WINDOWP (selected_window)
&& EQ (XWINDOW (selected_window)->buffer, new_current_buffer)
&& !EQ (selected_window, data->current_window))
- old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos;
+ old_point = marker_position (XWINDOW (data->current_window)->pointm);
else
old_point = PT;
else
@@ -5577,7 +5579,7 @@ the return value is nil. Otherwise the value is t. */)
if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)
/* If current_window = selected_window, its point is in BUF_PT. */
&& !EQ (selected_window, data->current_window))
- old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos;
+ old_point = marker_position (XWINDOW (data->current_window)->pointm);
else
old_point = BUF_PT (XBUFFER (new_current_buffer));
}
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)
del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, 0);
}
}
- BEGV = XMARKER (oldbegv)->charpos;
+ BEGV = marker_position (oldbegv);
BEGV_BYTE = marker_byte_position (oldbegv);
if (zv_at_end)
@@ -9505,7 +9505,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
}
else
{
- ZV = XMARKER (oldzv)->charpos;
+ ZV = marker_position (oldzv);
ZV_BYTE = marker_byte_position (oldzv);
}
@@ -9514,8 +9514,8 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
else
/* We can't do Fgoto_char (oldpoint) because it will run some
Lisp code. */
- TEMP_SET_PT_BOTH (XMARKER (oldpoint)->charpos,
- XMARKER (oldpoint)->bytepos);
+ TEMP_SET_PT_BOTH (marker_position (oldpoint),
+ marker_byte_position (oldpoint));
UNGCPRO;
unchain_marker (XMARKER (oldpoint));
@@ -10087,8 +10087,8 @@ with_echo_area_buffer_unwind_data (struct window *w)
{
XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i;
ASET (vector, i, w->buffer); ++i;
- ASET (vector, i, make_number (XMARKER (w->pointm)->charpos)); ++i;
- ASET (vector, i, make_number (XMARKER (w->pointm)->bytepos)); ++i;
+ ASET (vector, i, make_number (marker_position (w->pointm))); ++i;
+ ASET (vector, i, make_number (marker_byte_position (w->pointm))); ++i;
}
else
{
@@ -13801,7 +13801,7 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
if (w == XWINDOW (selected_window))
w->last_point = BUF_PT (b);
else
- w->last_point = XMARKER (w->pointm)->charpos;
+ w->last_point = marker_position (w->pointm);
}
}
@@ -15562,7 +15562,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
window, set up appropriate value. */
if (!EQ (window, selected_window))
{
- ptrdiff_t new_pt = XMARKER (w->pointm)->charpos;
+ ptrdiff_t new_pt = marker_position (w->pointm);
ptrdiff_t new_pt_byte = marker_byte_position (w->pointm);
if (new_pt < BEGV)
{
@@ -21526,7 +21526,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
if (mode_line_target == MODE_LINE_TITLE)
return "";
- startpos = XMARKER (w->start)->charpos;
+ startpos = marker_position (w->start);
startpos_byte = marker_byte_position (w->start);
height = WINDOW_TOTAL_LINES (w);