diff options
author | Jim Blandy <jimb@redhat.com> | 1993-05-24 20:57:32 +0000 |
---|---|---|
committer | Jim Blandy <jimb@redhat.com> | 1993-05-24 20:57:32 +0000 |
commit | 883047b99c85012855f53abeb2733f742ff10cf8 (patch) | |
tree | 8d20cbe0e04ddd128bfa69558f0ce517af9a7067 /src/buffer.c | |
parent | af395ec10ec6fa01978817062bac69a45c51ba41 (diff) | |
download | emacs-883047b99c85012855f53abeb2733f742ff10cf8.tar.gz |
* 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.
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/buffer.c b/src/buffer.c index 3a90154992d..b50e7d0f1b0 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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); |