Commit 883047b9 authored by Jim Blandy's avatar Jim Blandy
Browse files

* buffer.c (Fmake_overlay): Put beg and end in the

	right order.
	(Fmove_overlay): If beg and end are markers, make sure they're in
	the right buffer.
parent af395ec1
......@@ -1489,28 +1489,28 @@ BEG and END may be integers or markers.")
if (NILP (buffer))
XSET (buffer, Lisp_Buffer, current_buffer);
CHECK_BUFFER (buffer, 2);
else
CHECK_BUFFER (buffer, 2);
if (MARKERP (beg)
&& ! EQ (Fmarker_buffer (beg), buffer))
error ("Marker points into wrong buffer");
if (MARKERP (end)
&& ! EQ (Fmarker_buffer (end), buffer))
error ("Marker points into wrong buffer");
b = XBUFFER (buffer);
CHECK_NUMBER_COERCE_MARKER (beg, 1);
CHECK_NUMBER_COERCE_MARKER (end, 1);
if (MARKERP (beg))
{
if (! EQ (Fmarker_buffer (beg), buffer))
error ("Marker points into wrong buffer");
else
beg = Fcopy_marker (beg);
}
else
beg = Fset_marker (Fmake_marker (), beg, buffer);
if (MARKERP (end))
if (XINT (beg) > XINT (end))
{
if (! EQ (Fmarker_buffer (end), buffer))
error ("Marker points into wrong buffer");
else
end = Fcopy_marker (end);
Lisp_Object temp = beg;
beg = end; end = temp;
}
else
end = Fset_marker (Fmake_marker (), end, buffer);
b = XBUFFER (buffer);
beg = Fset_marker (Fmake_marker (), beg, buffer);
end = Fset_marker (Fmake_marker (), end, buffer);
overlay = Fcons (Fcons (beg, end), Qnil);
XSETTYPE (overlay, Lisp_Overlay);
......@@ -1547,6 +1547,14 @@ buffer.")
if (NILP (buffer))
XSET (buffer, Lisp_Buffer, current_buffer);
CHECK_BUFFER (buffer, 3);
if (MARKERP (beg)
&& ! EQ (Fmarker_buffer (beg), buffer))
error ("Marker points into wrong buffer");
if (MARKERP (end)
&& ! EQ (Fmarker_buffer (end), buffer))
error ("Marker points into wrong buffer");
CHECK_NUMBER_COERCE_MARKER (beg, 1);
CHECK_NUMBER_COERCE_MARKER (end, 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment