diff options
| author | Richard M. Stallman | 1996-09-25 08:01:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-09-25 08:01:52 +0000 |
| commit | 26c76ace8de7d0fa687d8a76b3a3bce5fb1ee692 (patch) | |
| tree | 2b3703577c770f6bb2abde025755c34e386f3b56 | |
| parent | f66868bad1c2b1e156840e15a61550fe1a307943 (diff) | |
| download | emacs-26c76ace8de7d0fa687d8a76b3a3bce5fb1ee692.tar.gz emacs-26c76ace8de7d0fa687d8a76b3a3bce5fb1ee692.zip | |
(set_properties, add_properties, remove_properties):
Don't call modify_region or signal_after_change here.
(Fset_text_properties, Fadd_text_properties, Fremove_text_properties):
Call them here when appropriate.
| -rw-r--r-- | src/textprop.c | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/src/textprop.c b/src/textprop.c index 0ef85117eac..27698f925e1 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -299,14 +299,9 @@ set_properties (properties, interval, object) | |||
| 299 | if (! EQ (property_value (properties, XCONS (sym)->car), | 299 | if (! EQ (property_value (properties, XCONS (sym)->car), |
| 300 | XCONS (value)->car)) | 300 | XCONS (value)->car)) |
| 301 | { | 301 | { |
| 302 | modify_region (XBUFFER (object), | ||
| 303 | interval->position, | ||
| 304 | interval->position + LENGTH (interval)); | ||
| 305 | record_property_change (interval->position, LENGTH (interval), | 302 | record_property_change (interval->position, LENGTH (interval), |
| 306 | XCONS (sym)->car, XCONS (value)->car, | 303 | XCONS (sym)->car, XCONS (value)->car, |
| 307 | object); | 304 | object); |
| 308 | signal_after_change (interval->position, LENGTH (interval), | ||
| 309 | LENGTH (interval)); | ||
| 310 | } | 305 | } |
| 311 | 306 | ||
| 312 | /* For each new property that has no value at all in the old plist, | 307 | /* For each new property that has no value at all in the old plist, |
| @@ -316,14 +311,9 @@ set_properties (properties, interval, object) | |||
| 316 | sym = XCONS (value)->cdr) | 311 | sym = XCONS (value)->cdr) |
| 317 | if (EQ (property_value (interval->plist, XCONS (sym)->car), Qunbound)) | 312 | if (EQ (property_value (interval->plist, XCONS (sym)->car), Qunbound)) |
| 318 | { | 313 | { |
| 319 | modify_region (XBUFFER (object), | ||
| 320 | interval->position, | ||
| 321 | interval->position + LENGTH (interval)); | ||
| 322 | record_property_change (interval->position, LENGTH (interval), | 314 | record_property_change (interval->position, LENGTH (interval), |
| 323 | XCONS (sym)->car, Qnil, | 315 | XCONS (sym)->car, Qnil, |
| 324 | object); | 316 | object); |
| 325 | signal_after_change (interval->position, LENGTH (interval), | ||
| 326 | LENGTH (interval)); | ||
| 327 | } | 317 | } |
| 328 | } | 318 | } |
| 329 | 319 | ||
| @@ -386,12 +376,8 @@ add_properties (plist, i, object) | |||
| 386 | /* Record this change in the buffer, for undo purposes. */ | 376 | /* Record this change in the buffer, for undo purposes. */ |
| 387 | if (BUFFERP (object)) | 377 | if (BUFFERP (object)) |
| 388 | { | 378 | { |
| 389 | modify_region (XBUFFER (object), | ||
| 390 | i->position, | ||
| 391 | i->position + LENGTH (i)); | ||
| 392 | record_property_change (i->position, LENGTH (i), | 379 | record_property_change (i->position, LENGTH (i), |
| 393 | sym1, Fcar (this_cdr), object); | 380 | sym1, Fcar (this_cdr), object); |
| 394 | signal_after_change (i->position, LENGTH (i), LENGTH (i)); | ||
| 395 | } | 381 | } |
| 396 | 382 | ||
| 397 | /* I's property has a different value -- change it */ | 383 | /* I's property has a different value -- change it */ |
| @@ -405,12 +391,8 @@ add_properties (plist, i, object) | |||
| 405 | /* Record this change in the buffer, for undo purposes. */ | 391 | /* Record this change in the buffer, for undo purposes. */ |
| 406 | if (BUFFERP (object)) | 392 | if (BUFFERP (object)) |
| 407 | { | 393 | { |
| 408 | modify_region (XBUFFER (object), | ||
| 409 | i->position, | ||
| 410 | i->position + LENGTH (i)); | ||
| 411 | record_property_change (i->position, LENGTH (i), | 394 | record_property_change (i->position, LENGTH (i), |
| 412 | sym1, Qnil, object); | 395 | sym1, Qnil, object); |
| 413 | signal_after_change (i->position, LENGTH (i), LENGTH (i)); | ||
| 414 | } | 396 | } |
| 415 | i->plist = Fcons (sym1, Fcons (val1, i->plist)); | 397 | i->plist = Fcons (sym1, Fcons (val1, i->plist)); |
| 416 | changed++; | 398 | changed++; |
| @@ -446,13 +428,9 @@ remove_properties (plist, i, object) | |||
| 446 | { | 428 | { |
| 447 | if (BUFFERP (object)) | 429 | if (BUFFERP (object)) |
| 448 | { | 430 | { |
| 449 | modify_region (XBUFFER (object), | ||
| 450 | i->position, | ||
| 451 | i->position + LENGTH (i)); | ||
| 452 | record_property_change (i->position, LENGTH (i), | 431 | record_property_change (i->position, LENGTH (i), |
| 453 | sym, Fcar (Fcdr (current_plist)), | 432 | sym, Fcar (Fcdr (current_plist)), |
| 454 | object); | 433 | object); |
| 455 | signal_after_change (i->position, LENGTH (i), LENGTH (i)); | ||
| 456 | } | 434 | } |
| 457 | 435 | ||
| 458 | current_plist = Fcdr (Fcdr (current_plist)); | 436 | current_plist = Fcdr (Fcdr (current_plist)); |
| @@ -469,12 +447,8 @@ remove_properties (plist, i, object) | |||
| 469 | { | 447 | { |
| 470 | if (BUFFERP (object)) | 448 | if (BUFFERP (object)) |
| 471 | { | 449 | { |
| 472 | modify_region (XBUFFER (object), | ||
| 473 | i->position, | ||
| 474 | i->position + LENGTH (i)); | ||
| 475 | record_property_change (i->position, LENGTH (i), | 450 | record_property_change (i->position, LENGTH (i), |
| 476 | sym, Fcar (Fcdr (this)), object); | 451 | sym, Fcar (Fcdr (this)), object); |
| 477 | signal_after_change (i->position, LENGTH (i), LENGTH (i)); | ||
| 478 | } | 452 | } |
| 479 | 453 | ||
| 480 | Fsetcdr (Fcdr (tail2), Fcdr (Fcdr (this))); | 454 | Fsetcdr (Fcdr (tail2), Fcdr (Fcdr (this))); |
| @@ -897,6 +871,8 @@ Return t if any property value actually changed, nil otherwise.") | |||
| 897 | } | 871 | } |
| 898 | } | 872 | } |
| 899 | 873 | ||
| 874 | modify_region (XBUFFER (object), XINT (start), XINT (end)); | ||
| 875 | |||
| 900 | /* We are at the beginning of interval I, with LEN chars to scan. */ | 876 | /* We are at the beginning of interval I, with LEN chars to scan. */ |
| 901 | for (;;) | 877 | for (;;) |
| 902 | { | 878 | { |
| @@ -911,11 +887,18 @@ Return t if any property value actually changed, nil otherwise.") | |||
| 911 | UNGCPRO; | 887 | UNGCPRO; |
| 912 | 888 | ||
| 913 | if (interval_has_all_properties (properties, i)) | 889 | if (interval_has_all_properties (properties, i)) |
| 914 | return modified ? Qt : Qnil; | 890 | { |
| 891 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 892 | XINT (end) - XINT (start)); | ||
| 893 | |||
| 894 | return modified ? Qt : Qnil; | ||
| 895 | } | ||
| 915 | 896 | ||
| 916 | if (LENGTH (i) == len) | 897 | if (LENGTH (i) == len) |
| 917 | { | 898 | { |
| 918 | add_properties (properties, i, object); | 899 | add_properties (properties, i, object); |
| 900 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 901 | XINT (end) - XINT (start)); | ||
| 919 | return Qt; | 902 | return Qt; |
| 920 | } | 903 | } |
| 921 | 904 | ||
| @@ -924,6 +907,8 @@ Return t if any property value actually changed, nil otherwise.") | |||
| 924 | i = split_interval_left (unchanged, len); | 907 | i = split_interval_left (unchanged, len); |
| 925 | copy_properties (unchanged, i); | 908 | copy_properties (unchanged, i); |
| 926 | add_properties (properties, i, object); | 909 | add_properties (properties, i, object); |
| 910 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 911 | XINT (end) - XINT (start)); | ||
| 927 | return Qt; | 912 | return Qt; |
| 928 | } | 913 | } |
| 929 | 914 | ||
| @@ -964,6 +949,7 @@ is the string or buffer containing the text.") | |||
| 964 | register INTERVAL prev_changed = NULL_INTERVAL; | 949 | register INTERVAL prev_changed = NULL_INTERVAL; |
| 965 | register int s, len; | 950 | register int s, len; |
| 966 | Lisp_Object ostart, oend; | 951 | Lisp_Object ostart, oend; |
| 952 | int have_modified = 0; | ||
| 967 | 953 | ||
| 968 | ostart = start; | 954 | ostart = start; |
| 969 | oend = end; | 955 | oend = end; |
| @@ -979,7 +965,13 @@ is the string or buffer containing the text.") | |||
| 979 | && XFASTINT (start) == 0 | 965 | && XFASTINT (start) == 0 |
| 980 | && XFASTINT (end) == XSTRING (object)->size) | 966 | && XFASTINT (end) == XSTRING (object)->size) |
| 981 | { | 967 | { |
| 968 | if (! XSTRING (object)->intervals) | ||
| 969 | return Qt; | ||
| 970 | |||
| 971 | modify_region (XBUFFER (object), XINT (start), XINT (end)); | ||
| 982 | XSTRING (object)->intervals = 0; | 972 | XSTRING (object)->intervals = 0; |
| 973 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 974 | XINT (end) - XINT (start)); | ||
| 983 | return Qt; | 975 | return Qt; |
| 984 | } | 976 | } |
| 985 | 977 | ||
| @@ -1005,6 +997,8 @@ is the string or buffer containing the text.") | |||
| 1005 | s = XINT (start); | 997 | s = XINT (start); |
| 1006 | len = XINT (end) - s; | 998 | len = XINT (end) - s; |
| 1007 | 999 | ||
| 1000 | modify_region (XBUFFER (object), XINT (start), XINT (end)); | ||
| 1001 | |||
| 1008 | if (i->position != s) | 1002 | if (i->position != s) |
| 1009 | { | 1003 | { |
| 1010 | unchanged = i; | 1004 | unchanged = i; |
| @@ -1015,13 +1009,21 @@ is the string or buffer containing the text.") | |||
| 1015 | copy_properties (unchanged, i); | 1009 | copy_properties (unchanged, i); |
| 1016 | i = split_interval_left (i, len); | 1010 | i = split_interval_left (i, len); |
| 1017 | set_properties (properties, i, object); | 1011 | set_properties (properties, i, object); |
| 1012 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1013 | XINT (end) - XINT (start)); | ||
| 1014 | |||
| 1018 | return Qt; | 1015 | return Qt; |
| 1019 | } | 1016 | } |
| 1020 | 1017 | ||
| 1021 | set_properties (properties, i, object); | 1018 | set_properties (properties, i, object); |
| 1022 | 1019 | ||
| 1023 | if (LENGTH (i) == len) | 1020 | if (LENGTH (i) == len) |
| 1024 | return Qt; | 1021 | { |
| 1022 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1023 | XINT (end) - XINT (start)); | ||
| 1024 | |||
| 1025 | return Qt; | ||
| 1026 | } | ||
| 1025 | 1027 | ||
| 1026 | prev_changed = i; | 1028 | prev_changed = i; |
| 1027 | len -= LENGTH (i); | 1029 | len -= LENGTH (i); |
| @@ -1045,6 +1047,8 @@ is the string or buffer containing the text.") | |||
| 1045 | set_properties (properties, i, object); | 1047 | set_properties (properties, i, object); |
| 1046 | if (!NULL_INTERVAL_P (prev_changed)) | 1048 | if (!NULL_INTERVAL_P (prev_changed)) |
| 1047 | merge_interval_left (i); | 1049 | merge_interval_left (i); |
| 1050 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1051 | XINT (end) - XINT (start)); | ||
| 1048 | return Qt; | 1052 | return Qt; |
| 1049 | } | 1053 | } |
| 1050 | 1054 | ||
| @@ -1062,6 +1066,8 @@ is the string or buffer containing the text.") | |||
| 1062 | i = next_interval (i); | 1066 | i = next_interval (i); |
| 1063 | } | 1067 | } |
| 1064 | 1068 | ||
| 1069 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1070 | XINT (end) - XINT (start)); | ||
| 1065 | return Qt; | 1071 | return Qt; |
| 1066 | } | 1072 | } |
| 1067 | 1073 | ||
| @@ -1112,6 +1118,8 @@ Return t if any property was actually removed, nil otherwise.") | |||
| 1112 | } | 1118 | } |
| 1113 | } | 1119 | } |
| 1114 | 1120 | ||
| 1121 | modify_region (XBUFFER (object), XINT (start), XINT (end)); | ||
| 1122 | |||
| 1115 | /* We are at the beginning of an interval, with len to scan */ | 1123 | /* We are at the beginning of an interval, with len to scan */ |
| 1116 | for (;;) | 1124 | for (;;) |
| 1117 | { | 1125 | { |
| @@ -1126,6 +1134,8 @@ Return t if any property was actually removed, nil otherwise.") | |||
| 1126 | if (LENGTH (i) == len) | 1134 | if (LENGTH (i) == len) |
| 1127 | { | 1135 | { |
| 1128 | remove_properties (properties, i, object); | 1136 | remove_properties (properties, i, object); |
| 1137 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1138 | XINT (end) - XINT (start)); | ||
| 1129 | return Qt; | 1139 | return Qt; |
| 1130 | } | 1140 | } |
| 1131 | 1141 | ||
| @@ -1134,6 +1144,8 @@ Return t if any property was actually removed, nil otherwise.") | |||
| 1134 | i = split_interval_left (i, len); | 1144 | i = split_interval_left (i, len); |
| 1135 | copy_properties (unchanged, i); | 1145 | copy_properties (unchanged, i); |
| 1136 | remove_properties (properties, i, object); | 1146 | remove_properties (properties, i, object); |
| 1147 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1148 | XINT (end) - XINT (start)); | ||
| 1137 | return Qt; | 1149 | return Qt; |
| 1138 | } | 1150 | } |
| 1139 | 1151 | ||