diff options
author | Richard M. Stallman <rms@gnu.org> | 2001-11-26 20:10:04 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2001-11-26 20:10:04 +0000 |
commit | 49f68fd22b49386494eb0162cb115a5b6b2a9a1e (patch) | |
tree | 177bb3bfab85ba7e1f08c624fc0df235bd64d468 /src/textprop.c | |
parent | bf17ab094ead58218b79b1e8641442386e4b4bbe (diff) | |
download | emacs-49f68fd22b49386494eb0162cb115a5b6b2a9a1e.tar.gz |
(set_text_properties_1): Allow args in either order.
Do nothing if range is empty.
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/textprop.c b/src/textprop.c index cd07484204b..7c6a5e6d686 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1304,7 +1304,7 @@ set_text_properties (start, end, properties, object, signal_after_change_p) the text. This does not obey any hooks. You can provide the interval that START is located in as I, or pass NULL for I and this function will find it. - This function assumes that START < END. */ + START and END can be in any order. */ void set_text_properties_1 (start, end, properties, buffer, i) @@ -1317,7 +1317,14 @@ set_text_properties_1 (start, end, properties, buffer, i) s = XINT (start); len = XINT (end) - s; - eassert (len > 0); + if (len == 0) + return; + if (len < 0) + { + s = s + len; + len = - len; + } + if (i == 0) i = find_interval (BUF_INTERVALS (XBUFFER (buffer)), s); |