Mercurial > emacs
comparison src/textprop.c @ 9109:6e44ddc40153
(validate_interval_range, add_properties, remove_properties,
Fnext_property_change, Fnext_single_property_change,
Fprevious_property_change, Fprevious_single_property_change,
Ftext_property_any, Ftext_property_not_all): Use type test macros.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 27 Sep 1994 01:16:02 +0000 |
parents | 2d4d0f6e7be0 |
children | 4b238c43e59f |
comparison
equal
deleted
inserted
replaced
9108:c0287cefc0f8 | 9109:6e44ddc40153 |
---|---|
115 n = *begin; | 115 n = *begin; |
116 *begin = *end; | 116 *begin = *end; |
117 *end = n; | 117 *end = n; |
118 } | 118 } |
119 | 119 |
120 if (XTYPE (object) == Lisp_Buffer) | 120 if (BUFFERP (object)) |
121 { | 121 { |
122 register struct buffer *b = XBUFFER (object); | 122 register struct buffer *b = XBUFFER (object); |
123 | 123 |
124 if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end) | 124 if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end) |
125 && XINT (*end) <= BUF_ZV (b))) | 125 && XINT (*end) <= BUF_ZV (b))) |
356 Continue to the next property. */ | 356 Continue to the next property. */ |
357 if (EQ (val1, Fcar (this_cdr))) | 357 if (EQ (val1, Fcar (this_cdr))) |
358 break; | 358 break; |
359 | 359 |
360 /* Record this change in the buffer, for undo purposes. */ | 360 /* Record this change in the buffer, for undo purposes. */ |
361 if (XTYPE (object) == Lisp_Buffer) | 361 if (BUFFERP (object)) |
362 { | 362 { |
363 modify_region (XBUFFER (object), | 363 modify_region (XBUFFER (object), |
364 make_number (i->position), | 364 make_number (i->position), |
365 make_number (i->position + LENGTH (i))); | 365 make_number (i->position + LENGTH (i))); |
366 record_property_change (i->position, LENGTH (i), | 366 record_property_change (i->position, LENGTH (i), |
374 } | 374 } |
375 | 375 |
376 if (! found) | 376 if (! found) |
377 { | 377 { |
378 /* Record this change in the buffer, for undo purposes. */ | 378 /* Record this change in the buffer, for undo purposes. */ |
379 if (XTYPE (object) == Lisp_Buffer) | 379 if (BUFFERP (object)) |
380 { | 380 { |
381 modify_region (XBUFFER (object), | 381 modify_region (XBUFFER (object), |
382 make_number (i->position), | 382 make_number (i->position), |
383 make_number (i->position + LENGTH (i))); | 383 make_number (i->position + LENGTH (i))); |
384 record_property_change (i->position, LENGTH (i), | 384 record_property_change (i->position, LENGTH (i), |
412 sym = Fcar (tail1); | 412 sym = Fcar (tail1); |
413 | 413 |
414 /* First, remove the symbol if its at the head of the list */ | 414 /* First, remove the symbol if its at the head of the list */ |
415 while (! NILP (current_plist) && EQ (sym, Fcar (current_plist))) | 415 while (! NILP (current_plist) && EQ (sym, Fcar (current_plist))) |
416 { | 416 { |
417 if (XTYPE (object) == Lisp_Buffer) | 417 if (BUFFERP (object)) |
418 { | 418 { |
419 modify_region (XBUFFER (object), | 419 modify_region (XBUFFER (object), |
420 make_number (i->position), | 420 make_number (i->position), |
421 make_number (i->position + LENGTH (i))); | 421 make_number (i->position + LENGTH (i))); |
422 record_property_change (i->position, LENGTH (i), | 422 record_property_change (i->position, LENGTH (i), |
434 { | 434 { |
435 register Lisp_Object this; | 435 register Lisp_Object this; |
436 this = Fcdr (Fcdr (tail2)); | 436 this = Fcdr (Fcdr (tail2)); |
437 if (EQ (sym, Fcar (this))) | 437 if (EQ (sym, Fcar (this))) |
438 { | 438 { |
439 if (XTYPE (object) == Lisp_Buffer) | 439 if (BUFFERP (object)) |
440 { | 440 { |
441 modify_region (XBUFFER (object), | 441 modify_region (XBUFFER (object), |
442 make_number (i->position), | 442 make_number (i->position), |
443 make_number (i->position + LENGTH (i))); | 443 make_number (i->position + LENGTH (i))); |
444 record_property_change (i->position, LENGTH (i), | 444 record_property_change (i->position, LENGTH (i), |
607 if (NULL_INTERVAL_P (next)) | 607 if (NULL_INTERVAL_P (next)) |
608 return limit; | 608 return limit; |
609 if (! NILP (limit) && !(next->position < XFASTINT (limit))) | 609 if (! NILP (limit) && !(next->position < XFASTINT (limit))) |
610 return limit; | 610 return limit; |
611 | 611 |
612 XFASTINT (pos) = next->position - (XTYPE (object) == Lisp_String); | 612 XFASTINT (pos) = next->position - (STRINGP (object)); |
613 return pos; | 613 return pos; |
614 } | 614 } |
615 | 615 |
616 /* Return 1 if there's a change in some property between BEG and END. */ | 616 /* Return 1 if there's a change in some property between BEG and END. */ |
617 | 617 |
682 if (NULL_INTERVAL_P (next)) | 682 if (NULL_INTERVAL_P (next)) |
683 return limit; | 683 return limit; |
684 if (! NILP (limit) && !(next->position < XFASTINT (limit))) | 684 if (! NILP (limit) && !(next->position < XFASTINT (limit))) |
685 return limit; | 685 return limit; |
686 | 686 |
687 XFASTINT (pos) = next->position - (XTYPE (object) == Lisp_String); | 687 XFASTINT (pos) = next->position - (STRINGP (object)); |
688 return pos; | 688 return pos; |
689 } | 689 } |
690 | 690 |
691 DEFUN ("previous-property-change", Fprevious_property_change, | 691 DEFUN ("previous-property-change", Fprevious_property_change, |
692 Sprevious_property_change, 1, 3, 0, | 692 Sprevious_property_change, 1, 3, 0, |
727 if (!NILP (limit) | 727 if (!NILP (limit) |
728 && !(previous->position + LENGTH (previous) > XFASTINT (limit))) | 728 && !(previous->position + LENGTH (previous) > XFASTINT (limit))) |
729 return limit; | 729 return limit; |
730 | 730 |
731 XFASTINT (pos) = (previous->position + LENGTH (previous) | 731 XFASTINT (pos) = (previous->position + LENGTH (previous) |
732 - (XTYPE (object) == Lisp_String)); | 732 - (STRINGP (object))); |
733 return pos; | 733 return pos; |
734 } | 734 } |
735 | 735 |
736 DEFUN ("previous-single-property-change", Fprevious_single_property_change, | 736 DEFUN ("previous-single-property-change", Fprevious_single_property_change, |
737 Sprevious_single_property_change, 2, 4, 0, | 737 Sprevious_single_property_change, 2, 4, 0, |
777 if (!NILP (limit) | 777 if (!NILP (limit) |
778 && !(previous->position + LENGTH (previous) > XFASTINT (limit))) | 778 && !(previous->position + LENGTH (previous) > XFASTINT (limit))) |
779 return limit; | 779 return limit; |
780 | 780 |
781 XFASTINT (pos) = (previous->position + LENGTH (previous) | 781 XFASTINT (pos) = (previous->position + LENGTH (previous) |
782 - (XTYPE (object) == Lisp_String)); | 782 - (STRINGP (object))); |
783 return pos; | 783 return pos; |
784 } | 784 } |
785 | 785 |
786 DEFUN ("add-text-properties", Fadd_text_properties, | 786 DEFUN ("add-text-properties", Fadd_text_properties, |
787 Sadd_text_properties, 3, 4, 0, | 787 Sadd_text_properties, 3, 4, 0, |
1082 if (EQ (textget (i->plist, prop), value)) | 1082 if (EQ (textget (i->plist, prop), value)) |
1083 { | 1083 { |
1084 pos = i->position; | 1084 pos = i->position; |
1085 if (pos < XINT (start)) | 1085 if (pos < XINT (start)) |
1086 pos = XINT (start); | 1086 pos = XINT (start); |
1087 return make_number (pos - (XTYPE (object) == Lisp_String)); | 1087 return make_number (pos - (STRINGP (object))); |
1088 } | 1088 } |
1089 i = next_interval (i); | 1089 i = next_interval (i); |
1090 } | 1090 } |
1091 return Qnil; | 1091 return Qnil; |
1092 } | 1092 } |
1118 break; | 1118 break; |
1119 if (! EQ (textget (i->plist, prop), value)) | 1119 if (! EQ (textget (i->plist, prop), value)) |
1120 { | 1120 { |
1121 if (i->position > s) | 1121 if (i->position > s) |
1122 s = i->position; | 1122 s = i->position; |
1123 return make_number (s - (XTYPE (object) == Lisp_String)); | 1123 return make_number (s - (STRINGP (object))); |
1124 } | 1124 } |
1125 i = next_interval (i); | 1125 i = next_interval (i); |
1126 } | 1126 } |
1127 return Qnil; | 1127 return Qnil; |
1128 } | 1128 } |