diff options
| author | Richard M. Stallman | 2001-11-11 20:03:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-11-11 20:03:24 +0000 |
| commit | 78ff4175b92b108b2476affb87edd3f074e03580 (patch) | |
| tree | cac67c28d345956ac1d19e2e1e540db4043a4160 /src/textprop.c | |
| parent | 34e096ed98d17af8e2838d8aa97e805302516927 (diff) | |
| download | emacs-78ff4175b92b108b2476affb87edd3f074e03580.tar.gz emacs-78ff4175b92b108b2476affb87edd3f074e03580.zip | |
(set_text_properties_1): New subroutine, broken out of set_text_properties.
(set_text_properties): Use set_text_properties_1.
Diffstat (limited to 'src/textprop.c')
| -rw-r--r-- | src/textprop.c | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/src/textprop.c b/src/textprop.c index 76600728d15..c56db051bb3 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -1290,12 +1290,37 @@ set_text_properties (start, end, properties, object, signal_after_change_p) | |||
| 1290 | return Qnil; | 1290 | return Qnil; |
| 1291 | } | 1291 | } |
| 1292 | 1292 | ||
| 1293 | s = XINT (start); | ||
| 1294 | len = XINT (end) - s; | ||
| 1295 | |||
| 1296 | if (BUFFERP (object)) | 1293 | if (BUFFERP (object)) |
| 1297 | modify_region (XBUFFER (object), XINT (start), XINT (end)); | 1294 | modify_region (XBUFFER (object), XINT (start), XINT (end)); |
| 1298 | 1295 | ||
| 1296 | set_text_properties_1 (start, end, properties, object, i); | ||
| 1297 | |||
| 1298 | if (BUFFERP (object) && !NILP (signal_after_change_p)) | ||
| 1299 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1300 | XINT (end) - XINT (start)); | ||
| 1301 | return Qt; | ||
| 1302 | } | ||
| 1303 | |||
| 1304 | /* Replace properties of text from START to END with new list of | ||
| 1305 | properties PROPERTIES. BUFFER is the buffer containing | ||
| 1306 | the text. This does not obey any hooks. | ||
| 1307 | You can provide the interval that START is located in as I, | ||
| 1308 | or pass NULL for I and this function will find it. */ | ||
| 1309 | |||
| 1310 | void | ||
| 1311 | set_text_properties_1 (start, end, properties, buffer, i) | ||
| 1312 | Lisp_Object start, end, properties, buffer; | ||
| 1313 | INTERVAL i; | ||
| 1314 | { | ||
| 1315 | register INTERVAL prev_changed = NULL_INTERVAL; | ||
| 1316 | register int s, len; | ||
| 1317 | INTERVAL unchanged; | ||
| 1318 | |||
| 1319 | s = XINT (start); | ||
| 1320 | len = XINT (end) - s; | ||
| 1321 | if (i == 0) | ||
| 1322 | i = find_interval (BUF_INTERVALS (XBUFFER (buffer)), s); | ||
| 1323 | |||
| 1299 | if (i->position != s) | 1324 | if (i->position != s) |
| 1300 | { | 1325 | { |
| 1301 | unchanged = i; | 1326 | unchanged = i; |
| @@ -1305,24 +1330,14 @@ set_text_properties (start, end, properties, object, signal_after_change_p) | |||
| 1305 | { | 1330 | { |
| 1306 | copy_properties (unchanged, i); | 1331 | copy_properties (unchanged, i); |
| 1307 | i = split_interval_left (i, len); | 1332 | i = split_interval_left (i, len); |
| 1308 | set_properties (properties, i, object); | 1333 | set_properties (properties, i, buffer); |
| 1309 | if (BUFFERP (object) && !NILP (signal_after_change_p)) | 1334 | return; |
| 1310 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1311 | XINT (end) - XINT (start)); | ||
| 1312 | |||
| 1313 | return Qt; | ||
| 1314 | } | 1335 | } |
| 1315 | 1336 | ||
| 1316 | set_properties (properties, i, object); | 1337 | set_properties (properties, i, buffer); |
| 1317 | 1338 | ||
| 1318 | if (LENGTH (i) == len) | 1339 | if (LENGTH (i) == len) |
| 1319 | { | 1340 | return; |
| 1320 | if (BUFFERP (object) && !NILP (signal_after_change_p)) | ||
| 1321 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1322 | XINT (end) - XINT (start)); | ||
| 1323 | |||
| 1324 | return Qt; | ||
| 1325 | } | ||
| 1326 | 1341 | ||
| 1327 | prev_changed = i; | 1342 | prev_changed = i; |
| 1328 | len -= LENGTH (i); | 1343 | len -= LENGTH (i); |
| @@ -1343,13 +1358,10 @@ set_text_properties (start, end, properties, object, signal_after_change_p) | |||
| 1343 | /* We have to call set_properties even if we are going to | 1358 | /* We have to call set_properties even if we are going to |
| 1344 | merge the intervals, so as to make the undo records | 1359 | merge the intervals, so as to make the undo records |
| 1345 | and cause redisplay to happen. */ | 1360 | and cause redisplay to happen. */ |
| 1346 | set_properties (properties, i, object); | 1361 | set_properties (properties, i, buffer); |
| 1347 | if (!NULL_INTERVAL_P (prev_changed)) | 1362 | if (!NULL_INTERVAL_P (prev_changed)) |
| 1348 | merge_interval_left (i); | 1363 | merge_interval_left (i); |
| 1349 | if (BUFFERP (object) && !NILP (signal_after_change_p)) | 1364 | return; |
| 1350 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1351 | XINT (end) - XINT (start)); | ||
| 1352 | return Qt; | ||
| 1353 | } | 1365 | } |
| 1354 | 1366 | ||
| 1355 | len -= LENGTH (i); | 1367 | len -= LENGTH (i); |
| @@ -1357,7 +1369,7 @@ set_text_properties (start, end, properties, object, signal_after_change_p) | |||
| 1357 | /* We have to call set_properties even if we are going to | 1369 | /* We have to call set_properties even if we are going to |
| 1358 | merge the intervals, so as to make the undo records | 1370 | merge the intervals, so as to make the undo records |
| 1359 | and cause redisplay to happen. */ | 1371 | and cause redisplay to happen. */ |
| 1360 | set_properties (properties, i, object); | 1372 | set_properties (properties, i, buffer); |
| 1361 | if (NULL_INTERVAL_P (prev_changed)) | 1373 | if (NULL_INTERVAL_P (prev_changed)) |
| 1362 | prev_changed = i; | 1374 | prev_changed = i; |
| 1363 | else | 1375 | else |
| @@ -1365,11 +1377,6 @@ set_text_properties (start, end, properties, object, signal_after_change_p) | |||
| 1365 | 1377 | ||
| 1366 | i = next_interval (i); | 1378 | i = next_interval (i); |
| 1367 | } | 1379 | } |
| 1368 | |||
| 1369 | if (BUFFERP (object) && !NILP (signal_after_change_p)) | ||
| 1370 | signal_after_change (XINT (start), XINT (end) - XINT (start), | ||
| 1371 | XINT (end) - XINT (start)); | ||
| 1372 | return Qt; | ||
| 1373 | } | 1380 | } |
| 1374 | 1381 | ||
| 1375 | DEFUN ("remove-text-properties", Fremove_text_properties, | 1382 | DEFUN ("remove-text-properties", Fremove_text_properties, |