aboutsummaryrefslogtreecommitdiffstats
path: root/src/textprop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/textprop.c')
-rw-r--r--src/textprop.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/src/textprop.c b/src/textprop.c
index fd70f039d22..a039c17ae64 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1001,17 +1001,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
1001 && (NILP (limit) || next->position < XFASTINT (limit))) 1001 && (NILP (limit) || next->position < XFASTINT (limit)))
1002 next = next_interval (next); 1002 next = next_interval (next);
1003 1003
1004 if (NULL_INTERVAL_P (next)) 1004 if (NULL_INTERVAL_P (next)
1005 return limit; 1005 || (next->position
1006 if (NILP (limit)) 1006 >= (INTEGERP (limit)
1007 XSETFASTINT (limit, (STRINGP (object) 1007 ? XFASTINT (limit)
1008 ? SCHARS (object) 1008 : (STRINGP (object)
1009 : BUF_ZV (XBUFFER (object)))); 1009 ? SCHARS (object)
1010 if (!(next->position < XFASTINT (limit))) 1010 : BUF_ZV (XBUFFER (object))))))
1011 return limit; 1011 return limit;
1012 1012 else
1013 XSETFASTINT (position, next->position); 1013 return make_number (next->position);
1014 return position;
1015} 1014}
1016 1015
1017/* Return 1 if there's a change in some property between BEG and END. */ 1016/* Return 1 if there's a change in some property between BEG and END. */
@@ -1083,16 +1082,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
1083 && (NILP (limit) || next->position < XFASTINT (limit))) 1082 && (NILP (limit) || next->position < XFASTINT (limit)))
1084 next = next_interval (next); 1083 next = next_interval (next);
1085 1084
1086 if (NULL_INTERVAL_P (next)) 1085 if (NULL_INTERVAL_P (next)
1087 return limit; 1086 || (next->position
1088 if (NILP (limit)) 1087 >= (INTEGERP (limit)
1089 XSETFASTINT (limit, (STRINGP (object) 1088 ? XFASTINT (limit)
1090 ? SCHARS (object) 1089 : (STRINGP (object)
1091 : BUF_ZV (XBUFFER (object)))); 1090 ? SCHARS (object)
1092 if (!(next->position < XFASTINT (limit))) 1091 : BUF_ZV (XBUFFER (object))))))
1093 return limit; 1092 return limit;
1094 1093 else
1095 return make_number (next->position); 1094 return make_number (next->position);
1096} 1095}
1097 1096
1098DEFUN ("previous-property-change", Fprevious_property_change, 1097DEFUN ("previous-property-change", Fprevious_property_change,
@@ -1132,14 +1131,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */)
1132 && (NILP (limit) 1131 && (NILP (limit)
1133 || (previous->position + LENGTH (previous) > XFASTINT (limit)))) 1132 || (previous->position + LENGTH (previous) > XFASTINT (limit))))
1134 previous = previous_interval (previous); 1133 previous = previous_interval (previous);
1135 if (NULL_INTERVAL_P (previous))
1136 return limit;
1137 if (NILP (limit))
1138 XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))));
1139 if (!(previous->position + LENGTH (previous) > XFASTINT (limit)))
1140 return limit;
1141 1134
1142 return make_number (previous->position + LENGTH (previous)); 1135 if (NULL_INTERVAL_P (previous)
1136 || (previous->position + LENGTH (previous)
1137 <= (INTEGERP (limit)
1138 ? XFASTINT (limit)
1139 : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))))))
1140 return limit;
1141 else
1142 return make_number (previous->position + LENGTH (previous));
1143} 1143}
1144 1144
1145DEFUN ("previous-single-property-change", Fprevious_single_property_change, 1145DEFUN ("previous-single-property-change", Fprevious_single_property_change,
@@ -1184,14 +1184,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */)
1184 && (NILP (limit) 1184 && (NILP (limit)
1185 || (previous->position + LENGTH (previous) > XFASTINT (limit)))) 1185 || (previous->position + LENGTH (previous) > XFASTINT (limit))))
1186 previous = previous_interval (previous); 1186 previous = previous_interval (previous);
1187 if (NULL_INTERVAL_P (previous))
1188 return limit;
1189 if (NILP (limit))
1190 XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))));
1191 if (!(previous->position + LENGTH (previous) > XFASTINT (limit)))
1192 return limit;
1193 1187
1194 return make_number (previous->position + LENGTH (previous)); 1188 if (NULL_INTERVAL_P (previous)
1189 || (previous->position + LENGTH (previous)
1190 <= (INTEGERP (limit)
1191 ? XFASTINT (limit)
1192 : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))))))
1193 return limit;
1194 else
1195 return make_number (previous->position + LENGTH (previous));
1195} 1196}
1196 1197
1197/* Callers note, this can GC when OBJECT is a buffer (or nil). */ 1198/* Callers note, this can GC when OBJECT is a buffer (or nil). */
@@ -1253,7 +1254,7 @@ Return t if any property value actually changed, nil otherwise. */)
1253 } 1254 }
1254 1255
1255 if (BUFFERP (object)) 1256 if (BUFFERP (object))
1256 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1257 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1257 1258
1258 /* We are at the beginning of interval I, with LEN chars to scan. */ 1259 /* We are at the beginning of interval I, with LEN chars to scan. */
1259 for (;;) 1260 for (;;)
@@ -1393,7 +1394,7 @@ set_text_properties (start, end, properties, object, signal_after_change_p)
1393 } 1394 }
1394 1395
1395 if (BUFFERP (object)) 1396 if (BUFFERP (object))
1396 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1397 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1397 1398
1398 set_text_properties_1 (start, end, properties, object, i); 1399 set_text_properties_1 (start, end, properties, object, i);
1399 1400
@@ -1541,7 +1542,7 @@ Use set-text-properties if you want to remove all text properties. */)
1541 } 1542 }
1542 1543
1543 if (BUFFERP (object)) 1544 if (BUFFERP (object))
1544 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1545 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1545 1546
1546 /* We are at the beginning of an interval, with len to scan */ 1547 /* We are at the beginning of an interval, with len to scan */
1547 for (;;) 1548 for (;;)
@@ -1655,7 +1656,7 @@ Return t if any property was actually removed, nil otherwise. */)
1655 if (LENGTH (i) == len) 1656 if (LENGTH (i) == len)
1656 { 1657 {
1657 if (!modified && BUFFERP (object)) 1658 if (!modified && BUFFERP (object))
1658 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1659 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1659 remove_properties (Qnil, properties, i, object); 1660 remove_properties (Qnil, properties, i, object);
1660 if (BUFFERP (object)) 1661 if (BUFFERP (object))
1661 signal_after_change (XINT (start), XINT (end) - XINT (start), 1662 signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1668,7 +1669,7 @@ Return t if any property was actually removed, nil otherwise. */)
1668 i = split_interval_left (i, len); 1669 i = split_interval_left (i, len);
1669 copy_properties (unchanged, i); 1670 copy_properties (unchanged, i);
1670 if (!modified && BUFFERP (object)) 1671 if (!modified && BUFFERP (object))
1671 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1672 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1672 remove_properties (Qnil, properties, i, object); 1673 remove_properties (Qnil, properties, i, object);
1673 if (BUFFERP (object)) 1674 if (BUFFERP (object))
1674 signal_after_change (XINT (start), XINT (end) - XINT (start), 1675 signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1679,7 +1680,7 @@ Return t if any property was actually removed, nil otherwise. */)
1679 if (interval_has_some_properties_list (properties, i)) 1680 if (interval_has_some_properties_list (properties, i))
1680 { 1681 {
1681 if (!modified && BUFFERP (object)) 1682 if (!modified && BUFFERP (object))
1682 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1683 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1683 remove_properties (Qnil, properties, i, object); 1684 remove_properties (Qnil, properties, i, object);
1684 modified = 1; 1685 modified = 1;
1685 } 1686 }