Mercurial > emacs
comparison src/textprop.c @ 4076:9fd5ecacfbbb
(Qinsert_in_front_hooks, Qinsert_behind_hooks): New vars.
(syms_of_textprop): Set them up.
(set_properties): Call modify_region.
(remove_properties): Call modify_region before record_property_change.
(add_properties): Likewise.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 13 Jul 1993 21:04:07 +0000 |
parents | 55da23f04d01 |
children | 8f5545cf9774 |
comparison
equal
deleted
inserted
replaced
4075:3a8e54f78c54 | 4076:9fd5ecacfbbb |
---|---|
42 Lisp_Object Qmouse_left; | 42 Lisp_Object Qmouse_left; |
43 Lisp_Object Qmouse_entered; | 43 Lisp_Object Qmouse_entered; |
44 Lisp_Object Qpoint_left; | 44 Lisp_Object Qpoint_left; |
45 Lisp_Object Qpoint_entered; | 45 Lisp_Object Qpoint_entered; |
46 Lisp_Object Qmodification_hooks; | 46 Lisp_Object Qmodification_hooks; |
47 Lisp_Object Qinsert_in_front_hooks; | |
48 Lisp_Object Qinsert_behind_hooks; | |
47 Lisp_Object Qcategory; | 49 Lisp_Object Qcategory; |
48 Lisp_Object Qlocal_map; | 50 Lisp_Object Qlocal_map; |
49 | 51 |
50 /* Visual properties text (including strings) may have. */ | 52 /* Visual properties text (including strings) may have. */ |
51 Lisp_Object Qforeground, Qbackground, Qfont, Qunderline, Qstipple; | 53 Lisp_Object Qforeground, Qbackground, Qfont, Qunderline, Qstipple; |
274 for (sym = interval->plist; | 276 for (sym = interval->plist; |
275 PLIST_ELT_P (sym, value); | 277 PLIST_ELT_P (sym, value); |
276 sym = XCONS (value)->cdr) | 278 sym = XCONS (value)->cdr) |
277 if (! EQ (property_value (properties, XCONS (sym)->car), | 279 if (! EQ (property_value (properties, XCONS (sym)->car), |
278 XCONS (value)->car)) | 280 XCONS (value)->car)) |
279 record_property_change (interval->position, LENGTH (interval), | 281 { |
280 XCONS (sym)->car, XCONS (value)->car, | 282 modify_region (XBUFFER (object), |
281 object); | 283 make_number (interval->position), |
284 make_number (interval->position + LENGTH (interval))); | |
285 record_property_change (interval->position, LENGTH (interval), | |
286 XCONS (sym)->car, XCONS (value)->car, | |
287 object); | |
288 } | |
282 | 289 |
283 /* For each new property that has no value at all in the old plist, | 290 /* For each new property that has no value at all in the old plist, |
284 make an undo record binding it to nil, so it will be removed. */ | 291 make an undo record binding it to nil, so it will be removed. */ |
285 for (sym = properties; | 292 for (sym = properties; |
286 PLIST_ELT_P (sym, value); | 293 PLIST_ELT_P (sym, value); |
287 sym = XCONS (value)->cdr) | 294 sym = XCONS (value)->cdr) |
288 if (EQ (property_value (interval->plist, XCONS (sym)->car), Qunbound)) | 295 if (EQ (property_value (interval->plist, XCONS (sym)->car), Qunbound)) |
289 record_property_change (interval->position, LENGTH (interval), | 296 { |
290 XCONS (sym)->car, Qnil, | 297 modify_region (XBUFFER (object), |
291 object); | 298 make_number (interval->position), |
299 make_number (interval->position + LENGTH (interval))); | |
300 record_property_change (interval->position, LENGTH (interval), | |
301 XCONS (sym)->car, Qnil, | |
302 object); | |
303 } | |
292 } | 304 } |
293 | 305 |
294 /* Store new properties. */ | 306 /* Store new properties. */ |
295 interval->plist = Fcopy_sequence (properties); | 307 interval->plist = Fcopy_sequence (properties); |
296 } | 308 } |
336 break; | 348 break; |
337 | 349 |
338 /* Record this change in the buffer, for undo purposes. */ | 350 /* Record this change in the buffer, for undo purposes. */ |
339 if (XTYPE (object) == Lisp_Buffer) | 351 if (XTYPE (object) == Lisp_Buffer) |
340 { | 352 { |
341 record_property_change (i->position, LENGTH (i), | |
342 sym1, Fcar (this_cdr), object); | |
343 modify_region (XBUFFER (object), | 353 modify_region (XBUFFER (object), |
344 make_number (i->position), | 354 make_number (i->position), |
345 make_number (i->position + LENGTH (i))); | 355 make_number (i->position + LENGTH (i))); |
356 record_property_change (i->position, LENGTH (i), | |
357 sym1, Fcar (this_cdr), object); | |
346 } | 358 } |
347 | 359 |
348 /* I's property has a different value -- change it */ | 360 /* I's property has a different value -- change it */ |
349 Fsetcar (this_cdr, val1); | 361 Fsetcar (this_cdr, val1); |
350 changed++; | 362 changed++; |
354 if (! found) | 366 if (! found) |
355 { | 367 { |
356 /* Record this change in the buffer, for undo purposes. */ | 368 /* Record this change in the buffer, for undo purposes. */ |
357 if (XTYPE (object) == Lisp_Buffer) | 369 if (XTYPE (object) == Lisp_Buffer) |
358 { | 370 { |
359 record_property_change (i->position, LENGTH (i), | |
360 sym1, Qnil, object); | |
361 modify_region (XBUFFER (object), | 371 modify_region (XBUFFER (object), |
362 make_number (i->position), | 372 make_number (i->position), |
363 make_number (i->position + LENGTH (i))); | 373 make_number (i->position + LENGTH (i))); |
374 record_property_change (i->position, LENGTH (i), | |
375 sym1, Qnil, object); | |
364 } | 376 } |
365 i->plist = Fcons (sym1, Fcons (val1, i->plist)); | 377 i->plist = Fcons (sym1, Fcons (val1, i->plist)); |
366 changed++; | 378 changed++; |
367 } | 379 } |
368 } | 380 } |
392 /* First, remove the symbol if its at the head of the list */ | 404 /* First, remove the symbol if its at the head of the list */ |
393 while (! NILP (current_plist) && EQ (sym, Fcar (current_plist))) | 405 while (! NILP (current_plist) && EQ (sym, Fcar (current_plist))) |
394 { | 406 { |
395 if (XTYPE (object) == Lisp_Buffer) | 407 if (XTYPE (object) == Lisp_Buffer) |
396 { | 408 { |
409 modify_region (XBUFFER (object), | |
410 make_number (i->position), | |
411 make_number (i->position + LENGTH (i))); | |
397 record_property_change (i->position, LENGTH (i), | 412 record_property_change (i->position, LENGTH (i), |
398 sym, Fcar (Fcdr (current_plist)), | 413 sym, Fcar (Fcdr (current_plist)), |
399 object); | 414 object); |
400 modify_region (XBUFFER (object), | |
401 make_number (i->position), | |
402 make_number (i->position + LENGTH (i))); | |
403 } | 415 } |
404 | 416 |
405 current_plist = Fcdr (Fcdr (current_plist)); | 417 current_plist = Fcdr (Fcdr (current_plist)); |
406 changed++; | 418 changed++; |
407 } | 419 } |
413 register Lisp_Object this = Fcdr (Fcdr (tail2)); | 425 register Lisp_Object this = Fcdr (Fcdr (tail2)); |
414 if (EQ (sym, Fcar (this))) | 426 if (EQ (sym, Fcar (this))) |
415 { | 427 { |
416 if (XTYPE (object) == Lisp_Buffer) | 428 if (XTYPE (object) == Lisp_Buffer) |
417 { | 429 { |
418 record_property_change (i->position, LENGTH (i), | |
419 sym, Fcar (Fcdr (this)), object); | |
420 modify_region (XBUFFER (object), | 430 modify_region (XBUFFER (object), |
421 make_number (i->position), | 431 make_number (i->position), |
422 make_number (i->position + LENGTH (i))); | 432 make_number (i->position + LENGTH (i))); |
433 record_property_change (i->position, LENGTH (i), | |
434 sym, Fcar (Fcdr (this)), object); | |
423 } | 435 } |
424 | 436 |
425 Fsetcdr (Fcdr (tail2), Fcdr (Fcdr (this))); | 437 Fsetcdr (Fcdr (tail2), Fcdr (Fcdr (this))); |
426 changed++; | 438 changed++; |
427 } | 439 } |
1130 Qpoint_left = intern ("point-left"); | 1142 Qpoint_left = intern ("point-left"); |
1131 staticpro (&Qpoint_entered); | 1143 staticpro (&Qpoint_entered); |
1132 Qpoint_entered = intern ("point-entered"); | 1144 Qpoint_entered = intern ("point-entered"); |
1133 staticpro (&Qmodification_hooks); | 1145 staticpro (&Qmodification_hooks); |
1134 Qmodification_hooks = intern ("modification-hooks"); | 1146 Qmodification_hooks = intern ("modification-hooks"); |
1147 staticpro (&Qinsert_in_front_hooks); | |
1148 Qinsert_in_front_hooks = intern ("insert-in-front-hooks"); | |
1149 staticpro (&Qinsert_behind_hooks); | |
1150 Qinsert_behind_hooks = intern ("insert-behind-hooks"); | |
1135 | 1151 |
1136 defsubr (&Stext_properties_at); | 1152 defsubr (&Stext_properties_at); |
1137 defsubr (&Sget_text_property); | 1153 defsubr (&Sget_text_property); |
1138 defsubr (&Snext_property_change); | 1154 defsubr (&Snext_property_change); |
1139 defsubr (&Snext_single_property_change); | 1155 defsubr (&Snext_single_property_change); |