diff options
| author | Kenichi Handa | 2012-08-16 21:25:17 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-08-16 21:25:17 +0900 |
| commit | d75ffb4ed0b2e72a9361a07d16a5c884a9459728 (patch) | |
| tree | 8ac5a6a8ae033fef7fbc7fb7b09a703ef4b0ed5b /src/textprop.c | |
| parent | 69c41c4070c86baac11a627e9c3d366420aeb7cc (diff) | |
| parent | 250c8ab9b8f6322959fa3122db83944c30c3894b (diff) | |
| download | emacs-d75ffb4ed0b2e72a9361a07d16a5c884a9459728.tar.gz emacs-d75ffb4ed0b2e72a9361a07d16a5c884a9459728.zip | |
merge trunk
Diffstat (limited to 'src/textprop.c')
| -rw-r--r-- | src/textprop.c | 145 |
1 files changed, 63 insertions, 82 deletions
diff --git a/src/textprop.c b/src/textprop.c index efce7259ce5..ac1980fde78 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -105,7 +105,7 @@ text_read_only (Lisp_Object propval) | |||
| 105 | Fprevious_property_change which call this function with BEGIN == END. | 105 | Fprevious_property_change which call this function with BEGIN == END. |
| 106 | Handle this case specially. | 106 | Handle this case specially. |
| 107 | 107 | ||
| 108 | If FORCE is soft (0), it's OK to return NULL_INTERVAL. Otherwise, | 108 | If FORCE is soft (0), it's OK to return NULL. Otherwise, |
| 109 | create an interval tree for OBJECT if one doesn't exist, provided | 109 | create an interval tree for OBJECT if one doesn't exist, provided |
| 110 | the object actually contains text. In the current design, if there | 110 | the object actually contains text. In the current design, if there |
| 111 | is no text, there can be no text properties. */ | 111 | is no text, there can be no text properties. */ |
| @@ -126,7 +126,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en | |||
| 126 | /* If we are asked for a point, but from a subr which operates | 126 | /* If we are asked for a point, but from a subr which operates |
| 127 | on a range, then return nothing. */ | 127 | on a range, then return nothing. */ |
| 128 | if (EQ (*begin, *end) && begin != end) | 128 | if (EQ (*begin, *end) && begin != end) |
| 129 | return NULL_INTERVAL; | 129 | return NULL; |
| 130 | 130 | ||
| 131 | if (XINT (*begin) > XINT (*end)) | 131 | if (XINT (*begin) > XINT (*end)) |
| 132 | { | 132 | { |
| @@ -143,11 +143,11 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en | |||
| 143 | if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end) | 143 | if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end) |
| 144 | && XINT (*end) <= BUF_ZV (b))) | 144 | && XINT (*end) <= BUF_ZV (b))) |
| 145 | args_out_of_range (*begin, *end); | 145 | args_out_of_range (*begin, *end); |
| 146 | i = BUF_INTERVALS (b); | 146 | i = buffer_get_intervals (b); |
| 147 | 147 | ||
| 148 | /* If there's no text, there are no properties. */ | 148 | /* If there's no text, there are no properties. */ |
| 149 | if (BUF_BEGV (b) == BUF_ZV (b)) | 149 | if (BUF_BEGV (b) == BUF_ZV (b)) |
| 150 | return NULL_INTERVAL; | 150 | return NULL; |
| 151 | 151 | ||
| 152 | searchpos = XINT (*begin); | 152 | searchpos = XINT (*begin); |
| 153 | } | 153 | } |
| @@ -161,15 +161,15 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en | |||
| 161 | XSETFASTINT (*begin, XFASTINT (*begin)); | 161 | XSETFASTINT (*begin, XFASTINT (*begin)); |
| 162 | if (begin != end) | 162 | if (begin != end) |
| 163 | XSETFASTINT (*end, XFASTINT (*end)); | 163 | XSETFASTINT (*end, XFASTINT (*end)); |
| 164 | i = STRING_INTERVALS (object); | 164 | i = string_get_intervals (object); |
| 165 | 165 | ||
| 166 | if (len == 0) | 166 | if (len == 0) |
| 167 | return NULL_INTERVAL; | 167 | return NULL; |
| 168 | 168 | ||
| 169 | searchpos = XINT (*begin); | 169 | searchpos = XINT (*begin); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | if (NULL_INTERVAL_P (i)) | 172 | if (!i) |
| 173 | return (force ? create_root_interval (object) : i); | 173 | return (force ? create_root_interval (object) : i); |
| 174 | 174 | ||
| 175 | return find_interval (i, searchpos); | 175 | return find_interval (i, searchpos); |
| @@ -338,7 +338,7 @@ set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object) | |||
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | /* Store new properties. */ | 340 | /* Store new properties. */ |
| 341 | interval->plist = Fcopy_sequence (properties); | 341 | interval_set_plist (interval, Fcopy_sequence (properties)); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | /* Add the properties of PLIST to the interval I, or set | 344 | /* Add the properties of PLIST to the interval I, or set |
| @@ -411,7 +411,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) | |||
| 411 | record_property_change (i->position, LENGTH (i), | 411 | record_property_change (i->position, LENGTH (i), |
| 412 | sym1, Qnil, object); | 412 | sym1, Qnil, object); |
| 413 | } | 413 | } |
| 414 | i->plist = Fcons (sym1, Fcons (val1, i->plist)); | 414 | interval_set_plist (i, Fcons (sym1, Fcons (val1, i->plist))); |
| 415 | changed++; | 415 | changed++; |
| 416 | } | 416 | } |
| 417 | } | 417 | } |
| @@ -484,24 +484,9 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object | |||
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | if (changed) | 486 | if (changed) |
| 487 | i->plist = current_plist; | 487 | interval_set_plist (i, current_plist); |
| 488 | return changed; | 488 | return changed; |
| 489 | } | 489 | } |
| 490 | |||
| 491 | #if 0 | ||
| 492 | /* Remove all properties from interval I. Return non-zero | ||
| 493 | if this changes the interval. */ | ||
| 494 | |||
| 495 | static inline int | ||
| 496 | erase_properties (INTERVAL i) | ||
| 497 | { | ||
| 498 | if (NILP (i->plist)) | ||
| 499 | return 0; | ||
| 500 | |||
| 501 | i->plist = Qnil; | ||
| 502 | return 1; | ||
| 503 | } | ||
| 504 | #endif | ||
| 505 | 490 | ||
| 506 | /* Returns the interval of POSITION in OBJECT. | 491 | /* Returns the interval of POSITION in OBJECT. |
| 507 | POSITION is BEG-based. */ | 492 | POSITION is BEG-based. */ |
| @@ -515,7 +500,7 @@ interval_of (ptrdiff_t position, Lisp_Object object) | |||
| 515 | if (NILP (object)) | 500 | if (NILP (object)) |
| 516 | XSETBUFFER (object, current_buffer); | 501 | XSETBUFFER (object, current_buffer); |
| 517 | else if (EQ (object, Qt)) | 502 | else if (EQ (object, Qt)) |
| 518 | return NULL_INTERVAL; | 503 | return NULL; |
| 519 | 504 | ||
| 520 | CHECK_STRING_OR_BUFFER (object); | 505 | CHECK_STRING_OR_BUFFER (object); |
| 521 | 506 | ||
| @@ -525,19 +510,19 @@ interval_of (ptrdiff_t position, Lisp_Object object) | |||
| 525 | 510 | ||
| 526 | beg = BUF_BEGV (b); | 511 | beg = BUF_BEGV (b); |
| 527 | end = BUF_ZV (b); | 512 | end = BUF_ZV (b); |
| 528 | i = BUF_INTERVALS (b); | 513 | i = buffer_get_intervals (b); |
| 529 | } | 514 | } |
| 530 | else | 515 | else |
| 531 | { | 516 | { |
| 532 | beg = 0; | 517 | beg = 0; |
| 533 | end = SCHARS (object); | 518 | end = SCHARS (object); |
| 534 | i = STRING_INTERVALS (object); | 519 | i = string_get_intervals (object); |
| 535 | } | 520 | } |
| 536 | 521 | ||
| 537 | if (!(beg <= position && position <= end)) | 522 | if (!(beg <= position && position <= end)) |
| 538 | args_out_of_range (make_number (position), make_number (position)); | 523 | args_out_of_range (make_number (position), make_number (position)); |
| 539 | if (beg == end || NULL_INTERVAL_P (i)) | 524 | if (beg == end || !i) |
| 540 | return NULL_INTERVAL; | 525 | return NULL; |
| 541 | 526 | ||
| 542 | return find_interval (i, position); | 527 | return find_interval (i, position); |
| 543 | } | 528 | } |
| @@ -557,7 +542,7 @@ If POSITION is at the end of OBJECT, the value is nil. */) | |||
| 557 | XSETBUFFER (object, current_buffer); | 542 | XSETBUFFER (object, current_buffer); |
| 558 | 543 | ||
| 559 | i = validate_interval_range (object, &position, &position, soft); | 544 | i = validate_interval_range (object, &position, &position, soft); |
| 560 | if (NULL_INTERVAL_P (i)) | 545 | if (!i) |
| 561 | return Qnil; | 546 | return Qnil; |
| 562 | /* If POSITION is at the end of the interval, | 547 | /* If POSITION is at the end of the interval, |
| 563 | it means it's the end of OBJECT. | 548 | it means it's the end of OBJECT. |
| @@ -937,12 +922,12 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 937 | bother checking further intervals. */ | 922 | bother checking further intervals. */ |
| 938 | if (EQ (limit, Qt)) | 923 | if (EQ (limit, Qt)) |
| 939 | { | 924 | { |
| 940 | if (NULL_INTERVAL_P (i)) | 925 | if (!i) |
| 941 | next = i; | 926 | next = i; |
| 942 | else | 927 | else |
| 943 | next = next_interval (i); | 928 | next = next_interval (i); |
| 944 | 929 | ||
| 945 | if (NULL_INTERVAL_P (next)) | 930 | if (!next) |
| 946 | XSETFASTINT (position, (STRINGP (object) | 931 | XSETFASTINT (position, (STRINGP (object) |
| 947 | ? SCHARS (object) | 932 | ? SCHARS (object) |
| 948 | : BUF_ZV (XBUFFER (object)))); | 933 | : BUF_ZV (XBUFFER (object)))); |
| @@ -951,16 +936,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 951 | return position; | 936 | return position; |
| 952 | } | 937 | } |
| 953 | 938 | ||
| 954 | if (NULL_INTERVAL_P (i)) | 939 | if (!i) |
| 955 | return limit; | 940 | return limit; |
| 956 | 941 | ||
| 957 | next = next_interval (i); | 942 | next = next_interval (i); |
| 958 | 943 | ||
| 959 | while (!NULL_INTERVAL_P (next) && intervals_equal (i, next) | 944 | while (next && intervals_equal (i, next) |
| 960 | && (NILP (limit) || next->position < XFASTINT (limit))) | 945 | && (NILP (limit) || next->position < XFASTINT (limit))) |
| 961 | next = next_interval (next); | 946 | next = next_interval (next); |
| 962 | 947 | ||
| 963 | if (NULL_INTERVAL_P (next) | 948 | if (!next |
| 964 | || (next->position | 949 | || (next->position |
| 965 | >= (INTEGERP (limit) | 950 | >= (INTEGERP (limit) |
| 966 | ? XFASTINT (limit) | 951 | ? XFASTINT (limit) |
| @@ -998,17 +983,17 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 998 | CHECK_NUMBER_COERCE_MARKER (limit); | 983 | CHECK_NUMBER_COERCE_MARKER (limit); |
| 999 | 984 | ||
| 1000 | i = validate_interval_range (object, &position, &position, soft); | 985 | i = validate_interval_range (object, &position, &position, soft); |
| 1001 | if (NULL_INTERVAL_P (i)) | 986 | if (!i) |
| 1002 | return limit; | 987 | return limit; |
| 1003 | 988 | ||
| 1004 | here_val = textget (i->plist, prop); | 989 | here_val = textget (i->plist, prop); |
| 1005 | next = next_interval (i); | 990 | next = next_interval (i); |
| 1006 | while (! NULL_INTERVAL_P (next) | 991 | while (next |
| 1007 | && EQ (here_val, textget (next->plist, prop)) | 992 | && EQ (here_val, textget (next->plist, prop)) |
| 1008 | && (NILP (limit) || next->position < XFASTINT (limit))) | 993 | && (NILP (limit) || next->position < XFASTINT (limit))) |
| 1009 | next = next_interval (next); | 994 | next = next_interval (next); |
| 1010 | 995 | ||
| 1011 | if (NULL_INTERVAL_P (next) | 996 | if (!next |
| 1012 | || (next->position | 997 | || (next->position |
| 1013 | >= (INTEGERP (limit) | 998 | >= (INTEGERP (limit) |
| 1014 | ? XFASTINT (limit) | 999 | ? XFASTINT (limit) |
| @@ -1044,7 +1029,7 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1044 | CHECK_NUMBER_COERCE_MARKER (limit); | 1029 | CHECK_NUMBER_COERCE_MARKER (limit); |
| 1045 | 1030 | ||
| 1046 | i = validate_interval_range (object, &position, &position, soft); | 1031 | i = validate_interval_range (object, &position, &position, soft); |
| 1047 | if (NULL_INTERVAL_P (i)) | 1032 | if (!i) |
| 1048 | return limit; | 1033 | return limit; |
| 1049 | 1034 | ||
| 1050 | /* Start with the interval containing the char before point. */ | 1035 | /* Start with the interval containing the char before point. */ |
| @@ -1052,12 +1037,12 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1052 | i = previous_interval (i); | 1037 | i = previous_interval (i); |
| 1053 | 1038 | ||
| 1054 | previous = previous_interval (i); | 1039 | previous = previous_interval (i); |
| 1055 | while (!NULL_INTERVAL_P (previous) && intervals_equal (previous, i) | 1040 | while (previous && intervals_equal (previous, i) |
| 1056 | && (NILP (limit) | 1041 | && (NILP (limit) |
| 1057 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) | 1042 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) |
| 1058 | previous = previous_interval (previous); | 1043 | previous = previous_interval (previous); |
| 1059 | 1044 | ||
| 1060 | if (NULL_INTERVAL_P (previous) | 1045 | if (!previous |
| 1061 | || (previous->position + LENGTH (previous) | 1046 | || (previous->position + LENGTH (previous) |
| 1062 | <= (INTEGERP (limit) | 1047 | <= (INTEGERP (limit) |
| 1063 | ? XFASTINT (limit) | 1048 | ? XFASTINT (limit) |
| @@ -1095,21 +1080,21 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1095 | i = validate_interval_range (object, &position, &position, soft); | 1080 | i = validate_interval_range (object, &position, &position, soft); |
| 1096 | 1081 | ||
| 1097 | /* Start with the interval containing the char before point. */ | 1082 | /* Start with the interval containing the char before point. */ |
| 1098 | if (!NULL_INTERVAL_P (i) && i->position == XFASTINT (position)) | 1083 | if (i && i->position == XFASTINT (position)) |
| 1099 | i = previous_interval (i); | 1084 | i = previous_interval (i); |
| 1100 | 1085 | ||
| 1101 | if (NULL_INTERVAL_P (i)) | 1086 | if (!i) |
| 1102 | return limit; | 1087 | return limit; |
| 1103 | 1088 | ||
| 1104 | here_val = textget (i->plist, prop); | 1089 | here_val = textget (i->plist, prop); |
| 1105 | previous = previous_interval (i); | 1090 | previous = previous_interval (i); |
| 1106 | while (!NULL_INTERVAL_P (previous) | 1091 | while (previous |
| 1107 | && EQ (here_val, textget (previous->plist, prop)) | 1092 | && EQ (here_val, textget (previous->plist, prop)) |
| 1108 | && (NILP (limit) | 1093 | && (NILP (limit) |
| 1109 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) | 1094 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) |
| 1110 | previous = previous_interval (previous); | 1095 | previous = previous_interval (previous); |
| 1111 | 1096 | ||
| 1112 | if (NULL_INTERVAL_P (previous) | 1097 | if (!previous |
| 1113 | || (previous->position + LENGTH (previous) | 1098 | || (previous->position + LENGTH (previous) |
| 1114 | <= (INTEGERP (limit) | 1099 | <= (INTEGERP (limit) |
| 1115 | ? XFASTINT (limit) | 1100 | ? XFASTINT (limit) |
| @@ -1145,7 +1130,7 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1145 | XSETBUFFER (object, current_buffer); | 1130 | XSETBUFFER (object, current_buffer); |
| 1146 | 1131 | ||
| 1147 | i = validate_interval_range (object, &start, &end, hard); | 1132 | i = validate_interval_range (object, &start, &end, hard); |
| 1148 | if (NULL_INTERVAL_P (i)) | 1133 | if (!i) |
| 1149 | return Qnil; | 1134 | return Qnil; |
| 1150 | 1135 | ||
| 1151 | s = XINT (start); | 1136 | s = XINT (start); |
| @@ -1183,8 +1168,7 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1183 | /* We are at the beginning of interval I, with LEN chars to scan. */ | 1168 | /* We are at the beginning of interval I, with LEN chars to scan. */ |
| 1184 | for (;;) | 1169 | for (;;) |
| 1185 | { | 1170 | { |
| 1186 | if (i == 0) | 1171 | eassert (i != 0); |
| 1187 | abort (); | ||
| 1188 | 1172 | ||
| 1189 | if (LENGTH (i) >= len) | 1173 | if (LENGTH (i) >= len) |
| 1190 | { | 1174 | { |
| @@ -1290,16 +1274,16 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1290 | && XFASTINT (start) == 0 | 1274 | && XFASTINT (start) == 0 |
| 1291 | && XFASTINT (end) == SCHARS (object)) | 1275 | && XFASTINT (end) == SCHARS (object)) |
| 1292 | { | 1276 | { |
| 1293 | if (! STRING_INTERVALS (object)) | 1277 | if (!string_get_intervals (object)) |
| 1294 | return Qnil; | 1278 | return Qnil; |
| 1295 | 1279 | ||
| 1296 | STRING_SET_INTERVALS (object, NULL_INTERVAL); | 1280 | string_set_intervals (object, NULL); |
| 1297 | return Qt; | 1281 | return Qt; |
| 1298 | } | 1282 | } |
| 1299 | 1283 | ||
| 1300 | i = validate_interval_range (object, &start, &end, soft); | 1284 | i = validate_interval_range (object, &start, &end, soft); |
| 1301 | 1285 | ||
| 1302 | if (NULL_INTERVAL_P (i)) | 1286 | if (!i) |
| 1303 | { | 1287 | { |
| 1304 | /* If buffer has no properties, and we want none, return now. */ | 1288 | /* If buffer has no properties, and we want none, return now. */ |
| 1305 | if (NILP (properties)) | 1289 | if (NILP (properties)) |
| @@ -1312,7 +1296,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1312 | 1296 | ||
| 1313 | i = validate_interval_range (object, &start, &end, hard); | 1297 | i = validate_interval_range (object, &start, &end, hard); |
| 1314 | /* This can return if start == end. */ | 1298 | /* This can return if start == end. */ |
| 1315 | if (NULL_INTERVAL_P (i)) | 1299 | if (!i) |
| 1316 | return Qnil; | 1300 | return Qnil; |
| 1317 | } | 1301 | } |
| 1318 | 1302 | ||
| @@ -1337,7 +1321,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1337 | void | 1321 | void |
| 1338 | set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) | 1322 | set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) |
| 1339 | { | 1323 | { |
| 1340 | register INTERVAL prev_changed = NULL_INTERVAL; | 1324 | register INTERVAL prev_changed = NULL; |
| 1341 | register ptrdiff_t s, len; | 1325 | register ptrdiff_t s, len; |
| 1342 | INTERVAL unchanged; | 1326 | INTERVAL unchanged; |
| 1343 | 1327 | ||
| @@ -1354,8 +1338,8 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1354 | else | 1338 | else |
| 1355 | return; | 1339 | return; |
| 1356 | 1340 | ||
| 1357 | if (i == 0) | 1341 | if (i == NULL) |
| 1358 | i = find_interval (BUF_INTERVALS (XBUFFER (buffer)), s); | 1342 | i = find_interval (buffer_get_intervals (XBUFFER (buffer)), s); |
| 1359 | 1343 | ||
| 1360 | if (i->position != s) | 1344 | if (i->position != s) |
| 1361 | { | 1345 | { |
| @@ -1383,8 +1367,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1383 | /* We are starting at the beginning of an interval I. LEN is positive. */ | 1367 | /* We are starting at the beginning of an interval I. LEN is positive. */ |
| 1384 | do | 1368 | do |
| 1385 | { | 1369 | { |
| 1386 | if (i == 0) | 1370 | eassert (i != 0); |
| 1387 | abort (); | ||
| 1388 | 1371 | ||
| 1389 | if (LENGTH (i) >= len) | 1372 | if (LENGTH (i) >= len) |
| 1390 | { | 1373 | { |
| @@ -1395,7 +1378,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1395 | merge the intervals, so as to make the undo records | 1378 | merge the intervals, so as to make the undo records |
| 1396 | and cause redisplay to happen. */ | 1379 | and cause redisplay to happen. */ |
| 1397 | set_properties (properties, i, buffer); | 1380 | set_properties (properties, i, buffer); |
| 1398 | if (!NULL_INTERVAL_P (prev_changed)) | 1381 | if (prev_changed) |
| 1399 | merge_interval_left (i); | 1382 | merge_interval_left (i); |
| 1400 | return; | 1383 | return; |
| 1401 | } | 1384 | } |
| @@ -1406,7 +1389,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1406 | merge the intervals, so as to make the undo records | 1389 | merge the intervals, so as to make the undo records |
| 1407 | and cause redisplay to happen. */ | 1390 | and cause redisplay to happen. */ |
| 1408 | set_properties (properties, i, buffer); | 1391 | set_properties (properties, i, buffer); |
| 1409 | if (NULL_INTERVAL_P (prev_changed)) | 1392 | if (!prev_changed) |
| 1410 | prev_changed = i; | 1393 | prev_changed = i; |
| 1411 | else | 1394 | else |
| 1412 | prev_changed = i = merge_interval_left (i); | 1395 | prev_changed = i = merge_interval_left (i); |
| @@ -1438,7 +1421,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1438 | XSETBUFFER (object, current_buffer); | 1421 | XSETBUFFER (object, current_buffer); |
| 1439 | 1422 | ||
| 1440 | i = validate_interval_range (object, &start, &end, soft); | 1423 | i = validate_interval_range (object, &start, &end, soft); |
| 1441 | if (NULL_INTERVAL_P (i)) | 1424 | if (!i) |
| 1442 | return Qnil; | 1425 | return Qnil; |
| 1443 | 1426 | ||
| 1444 | s = XINT (start); | 1427 | s = XINT (start); |
| @@ -1472,8 +1455,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1472 | /* We are at the beginning of an interval, with len to scan */ | 1455 | /* We are at the beginning of an interval, with len to scan */ |
| 1473 | for (;;) | 1456 | for (;;) |
| 1474 | { | 1457 | { |
| 1475 | if (i == 0) | 1458 | eassert (i != 0); |
| 1476 | abort (); | ||
| 1477 | 1459 | ||
| 1478 | if (LENGTH (i) >= len) | 1460 | if (LENGTH (i) >= len) |
| 1479 | { | 1461 | { |
| @@ -1526,7 +1508,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1526 | XSETBUFFER (object, current_buffer); | 1508 | XSETBUFFER (object, current_buffer); |
| 1527 | 1509 | ||
| 1528 | i = validate_interval_range (object, &start, &end, soft); | 1510 | i = validate_interval_range (object, &start, &end, soft); |
| 1529 | if (NULL_INTERVAL_P (i)) | 1511 | if (!i) |
| 1530 | return Qnil; | 1512 | return Qnil; |
| 1531 | 1513 | ||
| 1532 | s = XINT (start); | 1514 | s = XINT (start); |
| @@ -1562,8 +1544,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1562 | and we call signal_after_change before returning if modified != 0. */ | 1544 | and we call signal_after_change before returning if modified != 0. */ |
| 1563 | for (;;) | 1545 | for (;;) |
| 1564 | { | 1546 | { |
| 1565 | if (i == 0) | 1547 | eassert (i != 0); |
| 1566 | abort (); | ||
| 1567 | 1548 | ||
| 1568 | if (LENGTH (i) >= len) | 1549 | if (LENGTH (i) >= len) |
| 1569 | { | 1550 | { |
| @@ -1632,11 +1613,11 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1632 | if (NILP (object)) | 1613 | if (NILP (object)) |
| 1633 | XSETBUFFER (object, current_buffer); | 1614 | XSETBUFFER (object, current_buffer); |
| 1634 | i = validate_interval_range (object, &start, &end, soft); | 1615 | i = validate_interval_range (object, &start, &end, soft); |
| 1635 | if (NULL_INTERVAL_P (i)) | 1616 | if (!i) |
| 1636 | return (!NILP (value) || EQ (start, end) ? Qnil : start); | 1617 | return (!NILP (value) || EQ (start, end) ? Qnil : start); |
| 1637 | e = XINT (end); | 1618 | e = XINT (end); |
| 1638 | 1619 | ||
| 1639 | while (! NULL_INTERVAL_P (i)) | 1620 | while (i) |
| 1640 | { | 1621 | { |
| 1641 | if (i->position >= e) | 1622 | if (i->position >= e) |
| 1642 | break; | 1623 | break; |
| @@ -1668,12 +1649,12 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1668 | if (NILP (object)) | 1649 | if (NILP (object)) |
| 1669 | XSETBUFFER (object, current_buffer); | 1650 | XSETBUFFER (object, current_buffer); |
| 1670 | i = validate_interval_range (object, &start, &end, soft); | 1651 | i = validate_interval_range (object, &start, &end, soft); |
| 1671 | if (NULL_INTERVAL_P (i)) | 1652 | if (!i) |
| 1672 | return (NILP (value) || EQ (start, end)) ? Qnil : start; | 1653 | return (NILP (value) || EQ (start, end)) ? Qnil : start; |
| 1673 | s = XINT (start); | 1654 | s = XINT (start); |
| 1674 | e = XINT (end); | 1655 | e = XINT (end); |
| 1675 | 1656 | ||
| 1676 | while (! NULL_INTERVAL_P (i)) | 1657 | while (i) |
| 1677 | { | 1658 | { |
| 1678 | if (i->position >= e) | 1659 | if (i->position >= e) |
| 1679 | break; | 1660 | break; |
| @@ -1778,7 +1759,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1778 | struct gcpro gcpro1, gcpro2; | 1759 | struct gcpro gcpro1, gcpro2; |
| 1779 | 1760 | ||
| 1780 | i = validate_interval_range (src, &start, &end, soft); | 1761 | i = validate_interval_range (src, &start, &end, soft); |
| 1781 | if (NULL_INTERVAL_P (i)) | 1762 | if (!i) |
| 1782 | return Qnil; | 1763 | return Qnil; |
| 1783 | 1764 | ||
| 1784 | CHECK_NUMBER_COERCE_MARKER (pos); | 1765 | CHECK_NUMBER_COERCE_MARKER (pos); |
| @@ -1830,7 +1811,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1830 | } | 1811 | } |
| 1831 | 1812 | ||
| 1832 | i = next_interval (i); | 1813 | i = next_interval (i); |
| 1833 | if (NULL_INTERVAL_P (i)) | 1814 | if (!i) |
| 1834 | break; | 1815 | break; |
| 1835 | 1816 | ||
| 1836 | p += len; | 1817 | p += len; |
| @@ -1871,7 +1852,7 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp | |||
| 1871 | result = Qnil; | 1852 | result = Qnil; |
| 1872 | 1853 | ||
| 1873 | i = validate_interval_range (object, &start, &end, soft); | 1854 | i = validate_interval_range (object, &start, &end, soft); |
| 1874 | if (!NULL_INTERVAL_P (i)) | 1855 | if (i) |
| 1875 | { | 1856 | { |
| 1876 | ptrdiff_t s = XINT (start); | 1857 | ptrdiff_t s = XINT (start); |
| 1877 | ptrdiff_t e = XINT (end); | 1858 | ptrdiff_t e = XINT (end); |
| @@ -1903,7 +1884,7 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp | |||
| 1903 | result); | 1884 | result); |
| 1904 | 1885 | ||
| 1905 | i = next_interval (i); | 1886 | i = next_interval (i); |
| 1906 | if (NULL_INTERVAL_P (i)) | 1887 | if (!i) |
| 1907 | break; | 1888 | break; |
| 1908 | s = i->position; | 1889 | s = i->position; |
| 1909 | } | 1890 | } |
| @@ -2012,7 +1993,7 @@ void | |||
| 2012 | verify_interval_modification (struct buffer *buf, | 1993 | verify_interval_modification (struct buffer *buf, |
| 2013 | ptrdiff_t start, ptrdiff_t end) | 1994 | ptrdiff_t start, ptrdiff_t end) |
| 2014 | { | 1995 | { |
| 2015 | register INTERVAL intervals = BUF_INTERVALS (buf); | 1996 | register INTERVAL intervals = buffer_get_intervals (buf); |
| 2016 | register INTERVAL i; | 1997 | register INTERVAL i; |
| 2017 | Lisp_Object hooks; | 1998 | Lisp_Object hooks; |
| 2018 | register Lisp_Object prev_mod_hooks; | 1999 | register Lisp_Object prev_mod_hooks; |
| @@ -2026,7 +2007,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2026 | interval_insert_behind_hooks = Qnil; | 2007 | interval_insert_behind_hooks = Qnil; |
| 2027 | interval_insert_in_front_hooks = Qnil; | 2008 | interval_insert_in_front_hooks = Qnil; |
| 2028 | 2009 | ||
| 2029 | if (NULL_INTERVAL_P (intervals)) | 2010 | if (!intervals) |
| 2030 | return; | 2011 | return; |
| 2031 | 2012 | ||
| 2032 | if (start > end) | 2013 | if (start > end) |
| @@ -2067,7 +2048,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2067 | indirectly defined via the category property. */ | 2048 | indirectly defined via the category property. */ |
| 2068 | if (i != prev) | 2049 | if (i != prev) |
| 2069 | { | 2050 | { |
| 2070 | if (! NULL_INTERVAL_P (i)) | 2051 | if (i) |
| 2071 | { | 2052 | { |
| 2072 | after = textget (i->plist, Qread_only); | 2053 | after = textget (i->plist, Qread_only); |
| 2073 | 2054 | ||
| @@ -2087,7 +2068,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2087 | } | 2068 | } |
| 2088 | } | 2069 | } |
| 2089 | 2070 | ||
| 2090 | if (! NULL_INTERVAL_P (prev)) | 2071 | if (prev) |
| 2091 | { | 2072 | { |
| 2092 | before = textget (prev->plist, Qread_only); | 2073 | before = textget (prev->plist, Qread_only); |
| 2093 | 2074 | ||
| @@ -2107,7 +2088,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2107 | } | 2088 | } |
| 2108 | } | 2089 | } |
| 2109 | } | 2090 | } |
| 2110 | else if (! NULL_INTERVAL_P (i)) | 2091 | else if (i) |
| 2111 | { | 2092 | { |
| 2112 | after = textget (i->plist, Qread_only); | 2093 | after = textget (i->plist, Qread_only); |
| 2113 | 2094 | ||
| @@ -2134,10 +2115,10 @@ verify_interval_modification (struct buffer *buf, | |||
| 2134 | } | 2115 | } |
| 2135 | 2116 | ||
| 2136 | /* Run both insert hooks (just once if they're the same). */ | 2117 | /* Run both insert hooks (just once if they're the same). */ |
| 2137 | if (!NULL_INTERVAL_P (prev)) | 2118 | if (prev) |
| 2138 | interval_insert_behind_hooks | 2119 | interval_insert_behind_hooks |
| 2139 | = textget (prev->plist, Qinsert_behind_hooks); | 2120 | = textget (prev->plist, Qinsert_behind_hooks); |
| 2140 | if (!NULL_INTERVAL_P (i)) | 2121 | if (i) |
| 2141 | interval_insert_in_front_hooks | 2122 | interval_insert_in_front_hooks |
| 2142 | = textget (i->plist, Qinsert_in_front_hooks); | 2123 | = textget (i->plist, Qinsert_in_front_hooks); |
| 2143 | } | 2124 | } |
| @@ -2165,7 +2146,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2165 | i = next_interval (i); | 2146 | i = next_interval (i); |
| 2166 | } | 2147 | } |
| 2167 | /* Keep going thru the interval containing the char before END. */ | 2148 | /* Keep going thru the interval containing the char before END. */ |
| 2168 | while (! NULL_INTERVAL_P (i) && i->position < end); | 2149 | while (i && i->position < end); |
| 2169 | 2150 | ||
| 2170 | if (!inhibit_modification_hooks) | 2151 | if (!inhibit_modification_hooks) |
| 2171 | { | 2152 | { |