comparison src/textprop.c @ 26605:46168cb41ba0

(set_text_properties): New function. Like Fset_text_properties, but with additional parameter SIGNAL_AFTER_CHANGE_P. If that is nil, don't signal after changes. (Fset_text_properties): Use it.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 26 Nov 1999 12:07:31 +0000
parents c3c9cc1c2379
children ea588757e607
comparison
equal deleted inserted replaced
26604:381c4e70f9fb 26605:46168cb41ba0
1085 The optional fourth argument, OBJECT,\n\ 1085 The optional fourth argument, OBJECT,\n\
1086 is the string or buffer containing the text.") 1086 is the string or buffer containing the text.")
1087 (start, end, properties, object) 1087 (start, end, properties, object)
1088 Lisp_Object start, end, properties, object; 1088 Lisp_Object start, end, properties, object;
1089 { 1089 {
1090 return set_text_properties (start, end, properties, object, Qt);
1091 }
1092
1093
1094 /* Replace properties of text from START to END with new list of
1095 properties PROPERTIES. OBJECT is the buffer or string containing
1096 the text. OBJECT nil means use the current buffer.
1097 SIGNAL_AFTER_CHANGE_P nil means don't signal after changes. Value
1098 is non-nil if properties were replaced; it is nil if there weren't
1099 any properties to replace. */
1100
1101 Lisp_Object
1102 set_text_properties (start, end, properties, object, signal_after_change_p)
1103 Lisp_Object start, end, properties, object, signal_after_change_p;
1104 {
1090 register INTERVAL i, unchanged; 1105 register INTERVAL i, unchanged;
1091 register INTERVAL prev_changed = NULL_INTERVAL; 1106 register INTERVAL prev_changed = NULL_INTERVAL;
1092 register int s, len; 1107 register int s, len;
1093 Lisp_Object ostart, oend; 1108 Lisp_Object ostart, oend;
1094 1109
1146 if (LENGTH (i) > len) 1161 if (LENGTH (i) > len)
1147 { 1162 {
1148 copy_properties (unchanged, i); 1163 copy_properties (unchanged, i);
1149 i = split_interval_left (i, len); 1164 i = split_interval_left (i, len);
1150 set_properties (properties, i, object); 1165 set_properties (properties, i, object);
1151 if (BUFFERP (object)) 1166 if (BUFFERP (object) && !NILP (signal_after_change_p))
1152 signal_after_change (XINT (start), XINT (end) - XINT (start), 1167 signal_after_change (XINT (start), XINT (end) - XINT (start),
1153 XINT (end) - XINT (start)); 1168 XINT (end) - XINT (start));
1154 1169
1155 return Qt; 1170 return Qt;
1156 } 1171 }
1157 1172
1158 set_properties (properties, i, object); 1173 set_properties (properties, i, object);
1159 1174
1160 if (LENGTH (i) == len) 1175 if (LENGTH (i) == len)
1161 { 1176 {
1162 if (BUFFERP (object)) 1177 if (BUFFERP (object) && !NILP (signal_after_change_p))
1163 signal_after_change (XINT (start), XINT (end) - XINT (start), 1178 signal_after_change (XINT (start), XINT (end) - XINT (start),
1164 XINT (end) - XINT (start)); 1179 XINT (end) - XINT (start));
1165 1180
1166 return Qt; 1181 return Qt;
1167 } 1182 }
1186 merge the intervals, so as to make the undo records 1201 merge the intervals, so as to make the undo records
1187 and cause redisplay to happen. */ 1202 and cause redisplay to happen. */
1188 set_properties (properties, i, object); 1203 set_properties (properties, i, object);
1189 if (!NULL_INTERVAL_P (prev_changed)) 1204 if (!NULL_INTERVAL_P (prev_changed))
1190 merge_interval_left (i); 1205 merge_interval_left (i);
1191 if (BUFFERP (object)) 1206 if (BUFFERP (object) && !NILP (signal_after_change_p))
1192 signal_after_change (XINT (start), XINT (end) - XINT (start), 1207 signal_after_change (XINT (start), XINT (end) - XINT (start),
1193 XINT (end) - XINT (start)); 1208 XINT (end) - XINT (start));
1194 return Qt; 1209 return Qt;
1195 } 1210 }
1196 1211
1206 prev_changed = i = merge_interval_left (i); 1221 prev_changed = i = merge_interval_left (i);
1207 1222
1208 i = next_interval (i); 1223 i = next_interval (i);
1209 } 1224 }
1210 1225
1211 if (BUFFERP (object)) 1226 if (BUFFERP (object) && !NILP (signal_after_change_p))
1212 signal_after_change (XINT (start), XINT (end) - XINT (start), 1227 signal_after_change (XINT (start), XINT (end) - XINT (start),
1213 XINT (end) - XINT (start)); 1228 XINT (end) - XINT (start));
1214 return Qt; 1229 return Qt;
1215 } 1230 }
1216 1231