diff options
| author | Chong Yidong | 2006-09-12 16:47:26 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-09-12 16:47:26 +0000 |
| commit | 52c0f270f23feccccfca93bab5a353c02581bd5f (patch) | |
| tree | 4088e7b986fedd7afd8aeed4bfdd9a7c99543d5e | |
| parent | 4b1aaa8b07cf2797b5a57e2a1fd88f3ec0aa41e2 (diff) | |
| download | emacs-52c0f270f23feccccfca93bab5a353c02581bd5f.tar.gz emacs-52c0f270f23feccccfca93bab5a353c02581bd5f.zip | |
* textprop.c (Fnext_property_change, Fnext_single_property_change)
(Fprevious_property_change, Fprevious_single_property_change):
Avoid changing limit, so we can correctly catch the case where the
property is constant up to limit.
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/textprop.c | 67 |
2 files changed, 41 insertions, 33 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 67796c36985..890179bd822 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2006-09-12 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * textprop.c (Fnext_property_change, Fnext_single_property_change) | ||
| 4 | (Fprevious_property_change, Fprevious_single_property_change): | ||
| 5 | Avoid changing limit, so we can correctly catch the case where the | ||
| 6 | property is constant up to limit. | ||
| 7 | |||
| 1 | 2006-09-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 8 | 2006-09-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 9 | ||
| 3 | * macfns.c (mac_window) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: | 10 | * macfns.c (mac_window) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: |
diff --git a/src/textprop.c b/src/textprop.c index 785ed19b566..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 | ||
| 1098 | DEFUN ("previous-property-change", Fprevious_property_change, | 1097 | DEFUN ("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 | ||
| 1145 | DEFUN ("previous-single-property-change", Fprevious_single_property_change, | 1145 | DEFUN ("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). */ |