diff options
| author | Joakim Verona | 2012-08-15 21:49:40 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-08-15 21:49:40 +0200 |
| commit | b648c26ec642a1dc58c0bd7e59d6011b964dbe37 (patch) | |
| tree | f0f3b38ffa9054702f475fc53622e28da14f97b1 /src/textprop.c | |
| parent | c8b0fc1999006af5a4317b44068fac13d9592143 (diff) | |
| parent | 94c9ece10275f8ca9323c38f93607f1046035c79 (diff) | |
| download | emacs-b648c26ec642a1dc58c0bd7e59d6011b964dbe37.tar.gz emacs-b648c26ec642a1dc58c0bd7e59d6011b964dbe37.zip | |
upstream
Diffstat (limited to 'src/textprop.c')
| -rw-r--r-- | src/textprop.c | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/src/textprop.c b/src/textprop.c index ee5d82fa170..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,7 +484,7 @@ 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 | 490 | ||
| @@ -500,7 +500,7 @@ interval_of (ptrdiff_t position, Lisp_Object object) | |||
| 500 | if (NILP (object)) | 500 | if (NILP (object)) |
| 501 | XSETBUFFER (object, current_buffer); | 501 | XSETBUFFER (object, current_buffer); |
| 502 | else if (EQ (object, Qt)) | 502 | else if (EQ (object, Qt)) |
| 503 | return NULL_INTERVAL; | 503 | return NULL; |
| 504 | 504 | ||
| 505 | CHECK_STRING_OR_BUFFER (object); | 505 | CHECK_STRING_OR_BUFFER (object); |
| 506 | 506 | ||
| @@ -510,19 +510,19 @@ interval_of (ptrdiff_t position, Lisp_Object object) | |||
| 510 | 510 | ||
| 511 | beg = BUF_BEGV (b); | 511 | beg = BUF_BEGV (b); |
| 512 | end = BUF_ZV (b); | 512 | end = BUF_ZV (b); |
| 513 | i = BUF_INTERVALS (b); | 513 | i = buffer_get_intervals (b); |
| 514 | } | 514 | } |
| 515 | else | 515 | else |
| 516 | { | 516 | { |
| 517 | beg = 0; | 517 | beg = 0; |
| 518 | end = SCHARS (object); | 518 | end = SCHARS (object); |
| 519 | i = STRING_INTERVALS (object); | 519 | i = string_get_intervals (object); |
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | if (!(beg <= position && position <= end)) | 522 | if (!(beg <= position && position <= end)) |
| 523 | args_out_of_range (make_number (position), make_number (position)); | 523 | args_out_of_range (make_number (position), make_number (position)); |
| 524 | if (beg == end || NULL_INTERVAL_P (i)) | 524 | if (beg == end || !i) |
| 525 | return NULL_INTERVAL; | 525 | return NULL; |
| 526 | 526 | ||
| 527 | return find_interval (i, position); | 527 | return find_interval (i, position); |
| 528 | } | 528 | } |
| @@ -542,7 +542,7 @@ If POSITION is at the end of OBJECT, the value is nil. */) | |||
| 542 | XSETBUFFER (object, current_buffer); | 542 | XSETBUFFER (object, current_buffer); |
| 543 | 543 | ||
| 544 | i = validate_interval_range (object, &position, &position, soft); | 544 | i = validate_interval_range (object, &position, &position, soft); |
| 545 | if (NULL_INTERVAL_P (i)) | 545 | if (!i) |
| 546 | return Qnil; | 546 | return Qnil; |
| 547 | /* If POSITION is at the end of the interval, | 547 | /* If POSITION is at the end of the interval, |
| 548 | it means it's the end of OBJECT. | 548 | it means it's the end of OBJECT. |
| @@ -587,7 +587,7 @@ get_char_property_and_overlay (Lisp_Object position, register Lisp_Object prop, | |||
| 587 | if (WINDOWP (object)) | 587 | if (WINDOWP (object)) |
| 588 | { | 588 | { |
| 589 | w = XWINDOW (object); | 589 | w = XWINDOW (object); |
| 590 | object = WVAR (w, buffer); | 590 | object = w->buffer; |
| 591 | } | 591 | } |
| 592 | if (BUFFERP (object)) | 592 | if (BUFFERP (object)) |
| 593 | { | 593 | { |
| @@ -922,12 +922,12 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 922 | bother checking further intervals. */ | 922 | bother checking further intervals. */ |
| 923 | if (EQ (limit, Qt)) | 923 | if (EQ (limit, Qt)) |
| 924 | { | 924 | { |
| 925 | if (NULL_INTERVAL_P (i)) | 925 | if (!i) |
| 926 | next = i; | 926 | next = i; |
| 927 | else | 927 | else |
| 928 | next = next_interval (i); | 928 | next = next_interval (i); |
| 929 | 929 | ||
| 930 | if (NULL_INTERVAL_P (next)) | 930 | if (!next) |
| 931 | XSETFASTINT (position, (STRINGP (object) | 931 | XSETFASTINT (position, (STRINGP (object) |
| 932 | ? SCHARS (object) | 932 | ? SCHARS (object) |
| 933 | : BUF_ZV (XBUFFER (object)))); | 933 | : BUF_ZV (XBUFFER (object)))); |
| @@ -936,16 +936,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 936 | return position; | 936 | return position; |
| 937 | } | 937 | } |
| 938 | 938 | ||
| 939 | if (NULL_INTERVAL_P (i)) | 939 | if (!i) |
| 940 | return limit; | 940 | return limit; |
| 941 | 941 | ||
| 942 | next = next_interval (i); | 942 | next = next_interval (i); |
| 943 | 943 | ||
| 944 | while (!NULL_INTERVAL_P (next) && intervals_equal (i, next) | 944 | while (next && intervals_equal (i, next) |
| 945 | && (NILP (limit) || next->position < XFASTINT (limit))) | 945 | && (NILP (limit) || next->position < XFASTINT (limit))) |
| 946 | next = next_interval (next); | 946 | next = next_interval (next); |
| 947 | 947 | ||
| 948 | if (NULL_INTERVAL_P (next) | 948 | if (!next |
| 949 | || (next->position | 949 | || (next->position |
| 950 | >= (INTEGERP (limit) | 950 | >= (INTEGERP (limit) |
| 951 | ? XFASTINT (limit) | 951 | ? XFASTINT (limit) |
| @@ -983,17 +983,17 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 983 | CHECK_NUMBER_COERCE_MARKER (limit); | 983 | CHECK_NUMBER_COERCE_MARKER (limit); |
| 984 | 984 | ||
| 985 | i = validate_interval_range (object, &position, &position, soft); | 985 | i = validate_interval_range (object, &position, &position, soft); |
| 986 | if (NULL_INTERVAL_P (i)) | 986 | if (!i) |
| 987 | return limit; | 987 | return limit; |
| 988 | 988 | ||
| 989 | here_val = textget (i->plist, prop); | 989 | here_val = textget (i->plist, prop); |
| 990 | next = next_interval (i); | 990 | next = next_interval (i); |
| 991 | while (! NULL_INTERVAL_P (next) | 991 | while (next |
| 992 | && EQ (here_val, textget (next->plist, prop)) | 992 | && EQ (here_val, textget (next->plist, prop)) |
| 993 | && (NILP (limit) || next->position < XFASTINT (limit))) | 993 | && (NILP (limit) || next->position < XFASTINT (limit))) |
| 994 | next = next_interval (next); | 994 | next = next_interval (next); |
| 995 | 995 | ||
| 996 | if (NULL_INTERVAL_P (next) | 996 | if (!next |
| 997 | || (next->position | 997 | || (next->position |
| 998 | >= (INTEGERP (limit) | 998 | >= (INTEGERP (limit) |
| 999 | ? XFASTINT (limit) | 999 | ? XFASTINT (limit) |
| @@ -1029,7 +1029,7 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1029 | CHECK_NUMBER_COERCE_MARKER (limit); | 1029 | CHECK_NUMBER_COERCE_MARKER (limit); |
| 1030 | 1030 | ||
| 1031 | i = validate_interval_range (object, &position, &position, soft); | 1031 | i = validate_interval_range (object, &position, &position, soft); |
| 1032 | if (NULL_INTERVAL_P (i)) | 1032 | if (!i) |
| 1033 | return limit; | 1033 | return limit; |
| 1034 | 1034 | ||
| 1035 | /* Start with the interval containing the char before point. */ | 1035 | /* Start with the interval containing the char before point. */ |
| @@ -1037,12 +1037,12 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1037 | i = previous_interval (i); | 1037 | i = previous_interval (i); |
| 1038 | 1038 | ||
| 1039 | previous = previous_interval (i); | 1039 | previous = previous_interval (i); |
| 1040 | while (!NULL_INTERVAL_P (previous) && intervals_equal (previous, i) | 1040 | while (previous && intervals_equal (previous, i) |
| 1041 | && (NILP (limit) | 1041 | && (NILP (limit) |
| 1042 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) | 1042 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) |
| 1043 | previous = previous_interval (previous); | 1043 | previous = previous_interval (previous); |
| 1044 | 1044 | ||
| 1045 | if (NULL_INTERVAL_P (previous) | 1045 | if (!previous |
| 1046 | || (previous->position + LENGTH (previous) | 1046 | || (previous->position + LENGTH (previous) |
| 1047 | <= (INTEGERP (limit) | 1047 | <= (INTEGERP (limit) |
| 1048 | ? XFASTINT (limit) | 1048 | ? XFASTINT (limit) |
| @@ -1080,21 +1080,21 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1080 | i = validate_interval_range (object, &position, &position, soft); | 1080 | i = validate_interval_range (object, &position, &position, soft); |
| 1081 | 1081 | ||
| 1082 | /* Start with the interval containing the char before point. */ | 1082 | /* Start with the interval containing the char before point. */ |
| 1083 | if (!NULL_INTERVAL_P (i) && i->position == XFASTINT (position)) | 1083 | if (i && i->position == XFASTINT (position)) |
| 1084 | i = previous_interval (i); | 1084 | i = previous_interval (i); |
| 1085 | 1085 | ||
| 1086 | if (NULL_INTERVAL_P (i)) | 1086 | if (!i) |
| 1087 | return limit; | 1087 | return limit; |
| 1088 | 1088 | ||
| 1089 | here_val = textget (i->plist, prop); | 1089 | here_val = textget (i->plist, prop); |
| 1090 | previous = previous_interval (i); | 1090 | previous = previous_interval (i); |
| 1091 | while (!NULL_INTERVAL_P (previous) | 1091 | while (previous |
| 1092 | && EQ (here_val, textget (previous->plist, prop)) | 1092 | && EQ (here_val, textget (previous->plist, prop)) |
| 1093 | && (NILP (limit) | 1093 | && (NILP (limit) |
| 1094 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) | 1094 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) |
| 1095 | previous = previous_interval (previous); | 1095 | previous = previous_interval (previous); |
| 1096 | 1096 | ||
| 1097 | if (NULL_INTERVAL_P (previous) | 1097 | if (!previous |
| 1098 | || (previous->position + LENGTH (previous) | 1098 | || (previous->position + LENGTH (previous) |
| 1099 | <= (INTEGERP (limit) | 1099 | <= (INTEGERP (limit) |
| 1100 | ? XFASTINT (limit) | 1100 | ? XFASTINT (limit) |
| @@ -1130,7 +1130,7 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1130 | XSETBUFFER (object, current_buffer); | 1130 | XSETBUFFER (object, current_buffer); |
| 1131 | 1131 | ||
| 1132 | i = validate_interval_range (object, &start, &end, hard); | 1132 | i = validate_interval_range (object, &start, &end, hard); |
| 1133 | if (NULL_INTERVAL_P (i)) | 1133 | if (!i) |
| 1134 | return Qnil; | 1134 | return Qnil; |
| 1135 | 1135 | ||
| 1136 | s = XINT (start); | 1136 | s = XINT (start); |
| @@ -1274,16 +1274,16 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1274 | && XFASTINT (start) == 0 | 1274 | && XFASTINT (start) == 0 |
| 1275 | && XFASTINT (end) == SCHARS (object)) | 1275 | && XFASTINT (end) == SCHARS (object)) |
| 1276 | { | 1276 | { |
| 1277 | if (! STRING_INTERVALS (object)) | 1277 | if (!string_get_intervals (object)) |
| 1278 | return Qnil; | 1278 | return Qnil; |
| 1279 | 1279 | ||
| 1280 | STRING_SET_INTERVALS (object, NULL_INTERVAL); | 1280 | string_set_intervals (object, NULL); |
| 1281 | return Qt; | 1281 | return Qt; |
| 1282 | } | 1282 | } |
| 1283 | 1283 | ||
| 1284 | i = validate_interval_range (object, &start, &end, soft); | 1284 | i = validate_interval_range (object, &start, &end, soft); |
| 1285 | 1285 | ||
| 1286 | if (NULL_INTERVAL_P (i)) | 1286 | if (!i) |
| 1287 | { | 1287 | { |
| 1288 | /* If buffer has no properties, and we want none, return now. */ | 1288 | /* If buffer has no properties, and we want none, return now. */ |
| 1289 | if (NILP (properties)) | 1289 | if (NILP (properties)) |
| @@ -1296,7 +1296,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1296 | 1296 | ||
| 1297 | i = validate_interval_range (object, &start, &end, hard); | 1297 | i = validate_interval_range (object, &start, &end, hard); |
| 1298 | /* This can return if start == end. */ | 1298 | /* This can return if start == end. */ |
| 1299 | if (NULL_INTERVAL_P (i)) | 1299 | if (!i) |
| 1300 | return Qnil; | 1300 | return Qnil; |
| 1301 | } | 1301 | } |
| 1302 | 1302 | ||
| @@ -1321,7 +1321,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1321 | void | 1321 | void |
| 1322 | 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) |
| 1323 | { | 1323 | { |
| 1324 | register INTERVAL prev_changed = NULL_INTERVAL; | 1324 | register INTERVAL prev_changed = NULL; |
| 1325 | register ptrdiff_t s, len; | 1325 | register ptrdiff_t s, len; |
| 1326 | INTERVAL unchanged; | 1326 | INTERVAL unchanged; |
| 1327 | 1327 | ||
| @@ -1338,8 +1338,8 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1338 | else | 1338 | else |
| 1339 | return; | 1339 | return; |
| 1340 | 1340 | ||
| 1341 | if (i == 0) | 1341 | if (i == NULL) |
| 1342 | i = find_interval (BUF_INTERVALS (XBUFFER (buffer)), s); | 1342 | i = find_interval (buffer_get_intervals (XBUFFER (buffer)), s); |
| 1343 | 1343 | ||
| 1344 | if (i->position != s) | 1344 | if (i->position != s) |
| 1345 | { | 1345 | { |
| @@ -1378,7 +1378,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1378 | merge the intervals, so as to make the undo records | 1378 | merge the intervals, so as to make the undo records |
| 1379 | and cause redisplay to happen. */ | 1379 | and cause redisplay to happen. */ |
| 1380 | set_properties (properties, i, buffer); | 1380 | set_properties (properties, i, buffer); |
| 1381 | if (!NULL_INTERVAL_P (prev_changed)) | 1381 | if (prev_changed) |
| 1382 | merge_interval_left (i); | 1382 | merge_interval_left (i); |
| 1383 | return; | 1383 | return; |
| 1384 | } | 1384 | } |
| @@ -1389,7 +1389,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1389 | merge the intervals, so as to make the undo records | 1389 | merge the intervals, so as to make the undo records |
| 1390 | and cause redisplay to happen. */ | 1390 | and cause redisplay to happen. */ |
| 1391 | set_properties (properties, i, buffer); | 1391 | set_properties (properties, i, buffer); |
| 1392 | if (NULL_INTERVAL_P (prev_changed)) | 1392 | if (!prev_changed) |
| 1393 | prev_changed = i; | 1393 | prev_changed = i; |
| 1394 | else | 1394 | else |
| 1395 | prev_changed = i = merge_interval_left (i); | 1395 | prev_changed = i = merge_interval_left (i); |
| @@ -1421,7 +1421,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1421 | XSETBUFFER (object, current_buffer); | 1421 | XSETBUFFER (object, current_buffer); |
| 1422 | 1422 | ||
| 1423 | i = validate_interval_range (object, &start, &end, soft); | 1423 | i = validate_interval_range (object, &start, &end, soft); |
| 1424 | if (NULL_INTERVAL_P (i)) | 1424 | if (!i) |
| 1425 | return Qnil; | 1425 | return Qnil; |
| 1426 | 1426 | ||
| 1427 | s = XINT (start); | 1427 | s = XINT (start); |
| @@ -1508,7 +1508,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1508 | XSETBUFFER (object, current_buffer); | 1508 | XSETBUFFER (object, current_buffer); |
| 1509 | 1509 | ||
| 1510 | i = validate_interval_range (object, &start, &end, soft); | 1510 | i = validate_interval_range (object, &start, &end, soft); |
| 1511 | if (NULL_INTERVAL_P (i)) | 1511 | if (!i) |
| 1512 | return Qnil; | 1512 | return Qnil; |
| 1513 | 1513 | ||
| 1514 | s = XINT (start); | 1514 | s = XINT (start); |
| @@ -1613,11 +1613,11 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1613 | if (NILP (object)) | 1613 | if (NILP (object)) |
| 1614 | XSETBUFFER (object, current_buffer); | 1614 | XSETBUFFER (object, current_buffer); |
| 1615 | i = validate_interval_range (object, &start, &end, soft); | 1615 | i = validate_interval_range (object, &start, &end, soft); |
| 1616 | if (NULL_INTERVAL_P (i)) | 1616 | if (!i) |
| 1617 | return (!NILP (value) || EQ (start, end) ? Qnil : start); | 1617 | return (!NILP (value) || EQ (start, end) ? Qnil : start); |
| 1618 | e = XINT (end); | 1618 | e = XINT (end); |
| 1619 | 1619 | ||
| 1620 | while (! NULL_INTERVAL_P (i)) | 1620 | while (i) |
| 1621 | { | 1621 | { |
| 1622 | if (i->position >= e) | 1622 | if (i->position >= e) |
| 1623 | break; | 1623 | break; |
| @@ -1649,12 +1649,12 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1649 | if (NILP (object)) | 1649 | if (NILP (object)) |
| 1650 | XSETBUFFER (object, current_buffer); | 1650 | XSETBUFFER (object, current_buffer); |
| 1651 | i = validate_interval_range (object, &start, &end, soft); | 1651 | i = validate_interval_range (object, &start, &end, soft); |
| 1652 | if (NULL_INTERVAL_P (i)) | 1652 | if (!i) |
| 1653 | return (NILP (value) || EQ (start, end)) ? Qnil : start; | 1653 | return (NILP (value) || EQ (start, end)) ? Qnil : start; |
| 1654 | s = XINT (start); | 1654 | s = XINT (start); |
| 1655 | e = XINT (end); | 1655 | e = XINT (end); |
| 1656 | 1656 | ||
| 1657 | while (! NULL_INTERVAL_P (i)) | 1657 | while (i) |
| 1658 | { | 1658 | { |
| 1659 | if (i->position >= e) | 1659 | if (i->position >= e) |
| 1660 | break; | 1660 | break; |
| @@ -1759,7 +1759,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1759 | struct gcpro gcpro1, gcpro2; | 1759 | struct gcpro gcpro1, gcpro2; |
| 1760 | 1760 | ||
| 1761 | i = validate_interval_range (src, &start, &end, soft); | 1761 | i = validate_interval_range (src, &start, &end, soft); |
| 1762 | if (NULL_INTERVAL_P (i)) | 1762 | if (!i) |
| 1763 | return Qnil; | 1763 | return Qnil; |
| 1764 | 1764 | ||
| 1765 | CHECK_NUMBER_COERCE_MARKER (pos); | 1765 | CHECK_NUMBER_COERCE_MARKER (pos); |
| @@ -1811,7 +1811,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1811 | } | 1811 | } |
| 1812 | 1812 | ||
| 1813 | i = next_interval (i); | 1813 | i = next_interval (i); |
| 1814 | if (NULL_INTERVAL_P (i)) | 1814 | if (!i) |
| 1815 | break; | 1815 | break; |
| 1816 | 1816 | ||
| 1817 | p += len; | 1817 | p += len; |
| @@ -1852,7 +1852,7 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp | |||
| 1852 | result = Qnil; | 1852 | result = Qnil; |
| 1853 | 1853 | ||
| 1854 | i = validate_interval_range (object, &start, &end, soft); | 1854 | i = validate_interval_range (object, &start, &end, soft); |
| 1855 | if (!NULL_INTERVAL_P (i)) | 1855 | if (i) |
| 1856 | { | 1856 | { |
| 1857 | ptrdiff_t s = XINT (start); | 1857 | ptrdiff_t s = XINT (start); |
| 1858 | ptrdiff_t e = XINT (end); | 1858 | ptrdiff_t e = XINT (end); |
| @@ -1884,7 +1884,7 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp | |||
| 1884 | result); | 1884 | result); |
| 1885 | 1885 | ||
| 1886 | i = next_interval (i); | 1886 | i = next_interval (i); |
| 1887 | if (NULL_INTERVAL_P (i)) | 1887 | if (!i) |
| 1888 | break; | 1888 | break; |
| 1889 | s = i->position; | 1889 | s = i->position; |
| 1890 | } | 1890 | } |
| @@ -1993,7 +1993,7 @@ void | |||
| 1993 | verify_interval_modification (struct buffer *buf, | 1993 | verify_interval_modification (struct buffer *buf, |
| 1994 | ptrdiff_t start, ptrdiff_t end) | 1994 | ptrdiff_t start, ptrdiff_t end) |
| 1995 | { | 1995 | { |
| 1996 | register INTERVAL intervals = BUF_INTERVALS (buf); | 1996 | register INTERVAL intervals = buffer_get_intervals (buf); |
| 1997 | register INTERVAL i; | 1997 | register INTERVAL i; |
| 1998 | Lisp_Object hooks; | 1998 | Lisp_Object hooks; |
| 1999 | register Lisp_Object prev_mod_hooks; | 1999 | register Lisp_Object prev_mod_hooks; |
| @@ -2007,7 +2007,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2007 | interval_insert_behind_hooks = Qnil; | 2007 | interval_insert_behind_hooks = Qnil; |
| 2008 | interval_insert_in_front_hooks = Qnil; | 2008 | interval_insert_in_front_hooks = Qnil; |
| 2009 | 2009 | ||
| 2010 | if (NULL_INTERVAL_P (intervals)) | 2010 | if (!intervals) |
| 2011 | return; | 2011 | return; |
| 2012 | 2012 | ||
| 2013 | if (start > end) | 2013 | if (start > end) |
| @@ -2048,7 +2048,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2048 | indirectly defined via the category property. */ | 2048 | indirectly defined via the category property. */ |
| 2049 | if (i != prev) | 2049 | if (i != prev) |
| 2050 | { | 2050 | { |
| 2051 | if (! NULL_INTERVAL_P (i)) | 2051 | if (i) |
| 2052 | { | 2052 | { |
| 2053 | after = textget (i->plist, Qread_only); | 2053 | after = textget (i->plist, Qread_only); |
| 2054 | 2054 | ||
| @@ -2068,7 +2068,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2068 | } | 2068 | } |
| 2069 | } | 2069 | } |
| 2070 | 2070 | ||
| 2071 | if (! NULL_INTERVAL_P (prev)) | 2071 | if (prev) |
| 2072 | { | 2072 | { |
| 2073 | before = textget (prev->plist, Qread_only); | 2073 | before = textget (prev->plist, Qread_only); |
| 2074 | 2074 | ||
| @@ -2088,7 +2088,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2088 | } | 2088 | } |
| 2089 | } | 2089 | } |
| 2090 | } | 2090 | } |
| 2091 | else if (! NULL_INTERVAL_P (i)) | 2091 | else if (i) |
| 2092 | { | 2092 | { |
| 2093 | after = textget (i->plist, Qread_only); | 2093 | after = textget (i->plist, Qread_only); |
| 2094 | 2094 | ||
| @@ -2115,10 +2115,10 @@ verify_interval_modification (struct buffer *buf, | |||
| 2115 | } | 2115 | } |
| 2116 | 2116 | ||
| 2117 | /* Run both insert hooks (just once if they're the same). */ | 2117 | /* Run both insert hooks (just once if they're the same). */ |
| 2118 | if (!NULL_INTERVAL_P (prev)) | 2118 | if (prev) |
| 2119 | interval_insert_behind_hooks | 2119 | interval_insert_behind_hooks |
| 2120 | = textget (prev->plist, Qinsert_behind_hooks); | 2120 | = textget (prev->plist, Qinsert_behind_hooks); |
| 2121 | if (!NULL_INTERVAL_P (i)) | 2121 | if (i) |
| 2122 | interval_insert_in_front_hooks | 2122 | interval_insert_in_front_hooks |
| 2123 | = textget (i->plist, Qinsert_in_front_hooks); | 2123 | = textget (i->plist, Qinsert_in_front_hooks); |
| 2124 | } | 2124 | } |
| @@ -2146,7 +2146,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2146 | i = next_interval (i); | 2146 | i = next_interval (i); |
| 2147 | } | 2147 | } |
| 2148 | /* Keep going thru the interval containing the char before END. */ | 2148 | /* Keep going thru the interval containing the char before END. */ |
| 2149 | while (! NULL_INTERVAL_P (i) && i->position < end); | 2149 | while (i && i->position < end); |
| 2150 | 2150 | ||
| 2151 | if (!inhibit_modification_hooks) | 2151 | if (!inhibit_modification_hooks) |
| 2152 | { | 2152 | { |