diff options
| author | Richard M. Stallman | 1996-12-15 04:57:31 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-12-15 04:57:31 +0000 |
| commit | fcab51aabb2075da6edc18d91c221b23b77f5e8f (patch) | |
| tree | b436be94aa23449aef1498e5644956765a7731b6 /src | |
| parent | 21cd2849ae66494c3fc90483713c373d040587f8 (diff) | |
| download | emacs-fcab51aabb2075da6edc18d91c221b23b77f5e8f.tar.gz emacs-fcab51aabb2075da6edc18d91c221b23b77f5e8f.zip | |
(Fnext_char_property_change): New function.
(Fprevious_char_property_change): New function.
(syms_of_textprop): defsubr them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/textprop.c | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/src/textprop.c b/src/textprop.c index 0fce55c0ad2..3e667825d4b 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -584,7 +584,57 @@ overlays are considered only if they are associated with OBJECT.") | |||
| 584 | simpler case. */ | 584 | simpler case. */ |
| 585 | return (Fget_text_property (position, prop, object)); | 585 | return (Fget_text_property (position, prop, object)); |
| 586 | } | 586 | } |
| 587 | |||
| 588 | DEFUN ("next-char-property-change", Fnext_char_property_change, | ||
| 589 | Snext_char_property_change, 1, 2, 0, | ||
| 590 | "Return the position of next text property or overlay change.\n\ | ||
| 591 | This scans characters forward from POSITION in OBJECT till it finds\n\ | ||
| 592 | a change in some text property, or the beginning or end of an overlay,\n\ | ||
| 593 | and returns the position of that.\n\ | ||
| 594 | If none is found, the function returns (point-max).\n\ | ||
| 595 | \n\ | ||
| 596 | If the optional third argument LIMIT is non-nil, don't search\n\ | ||
| 597 | past position LIMIT; return LIMIT if nothing is found before LIMIT.") | ||
| 598 | (position, limit) | ||
| 599 | Lisp_Object position, limit; | ||
| 600 | { | ||
| 601 | Lisp_Object temp; | ||
| 602 | |||
| 603 | temp = Fnext_overlay_change (position); | ||
| 604 | if (! NILP (limit)) | ||
| 605 | { | ||
| 606 | CHECK_NUMBER (limit, 2); | ||
| 607 | if (XINT (limit) < XINT (temp)) | ||
| 608 | temp = limit; | ||
| 609 | } | ||
| 610 | return Fnext_property_change (position, Qnil, temp); | ||
| 611 | } | ||
| 612 | |||
| 613 | DEFUN ("previous-char-property-change", Fprevious_char_property_change, | ||
| 614 | Sprevious_char_property_change, 1, 2, 0, | ||
| 615 | "Return the position of previous text property or overlay change.\n\ | ||
| 616 | Scans characters backward from POSITION in OBJECT till it finds\n\ | ||
| 617 | a change in some text property, or the beginning or end of an overlay,\n\ | ||
| 618 | and returns the position of that.\n\ | ||
| 619 | If none is found, the function returns (point-max).\n\ | ||
| 620 | \n\ | ||
| 621 | If the optional third argument LIMIT is non-nil, don't search\n\ | ||
| 622 | past position LIMIT; return LIMIT if nothing is found before LIMIT.") | ||
| 623 | (position, limit) | ||
| 624 | Lisp_Object position, limit; | ||
| 625 | { | ||
| 626 | Lisp_Object temp; | ||
| 587 | 627 | ||
| 628 | temp = Fprevious_overlay_change (position); | ||
| 629 | if (! NILP (limit)) | ||
| 630 | { | ||
| 631 | CHECK_NUMBER (limit, 2); | ||
| 632 | if (XINT (limit) > XINT (temp)) | ||
| 633 | temp = limit; | ||
| 634 | } | ||
| 635 | return Fprevious_property_change (position, Qnil, temp); | ||
| 636 | } | ||
| 637 | |||
| 588 | DEFUN ("next-property-change", Fnext_property_change, | 638 | DEFUN ("next-property-change", Fnext_property_change, |
| 589 | Snext_property_change, 1, 3, 0, | 639 | Snext_property_change, 1, 3, 0, |
| 590 | "Return the position of next property change.\n\ | 640 | "Return the position of next property change.\n\ |
| @@ -813,7 +863,7 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT.") | |||
| 813 | - (STRINGP (object)))); | 863 | - (STRINGP (object)))); |
| 814 | return position; | 864 | return position; |
| 815 | } | 865 | } |
| 816 | 866 | ||
| 817 | /* Callers note, this can GC when OBJECT is a buffer (or nil). */ | 867 | /* Callers note, this can GC when OBJECT is a buffer (or nil). */ |
| 818 | 868 | ||
| 819 | DEFUN ("add-text-properties", Fadd_text_properties, | 869 | DEFUN ("add-text-properties", Fadd_text_properties, |
| @@ -1163,7 +1213,7 @@ Return t if any property was actually removed, nil otherwise.") | |||
| 1163 | i = next_interval (i); | 1213 | i = next_interval (i); |
| 1164 | } | 1214 | } |
| 1165 | } | 1215 | } |
| 1166 | 1216 | ||
| 1167 | DEFUN ("text-property-any", Ftext_property_any, | 1217 | DEFUN ("text-property-any", Ftext_property_any, |
| 1168 | Stext_property_any, 4, 5, 0, | 1218 | Stext_property_any, 4, 5, 0, |
| 1169 | "Check text from START to END for property PROPERTY equalling VALUE.\n\ | 1219 | "Check text from START to END for property PROPERTY equalling VALUE.\n\ |
| @@ -1235,7 +1285,7 @@ containing the text.") | |||
| 1235 | } | 1285 | } |
| 1236 | return Qnil; | 1286 | return Qnil; |
| 1237 | } | 1287 | } |
| 1238 | 1288 | ||
| 1239 | #if 0 /* You can use set-text-properties for this. */ | 1289 | #if 0 /* You can use set-text-properties for this. */ |
| 1240 | 1290 | ||
| 1241 | DEFUN ("erase-text-properties", Ferase_text_properties, | 1291 | DEFUN ("erase-text-properties", Ferase_text_properties, |
| @@ -1359,7 +1409,7 @@ is the string or buffer containing the text.") | |||
| 1359 | Return t if any property value actually changed, nil otherwise. */ | 1409 | Return t if any property value actually changed, nil otherwise. */ |
| 1360 | 1410 | ||
| 1361 | /* Note this can GC when DEST is a buffer. */ | 1411 | /* Note this can GC when DEST is a buffer. */ |
| 1362 | 1412 | ||
| 1363 | Lisp_Object | 1413 | Lisp_Object |
| 1364 | copy_text_properties (start, end, src, pos, dest, prop) | 1414 | copy_text_properties (start, end, src, pos, dest, prop) |
| 1365 | Lisp_Object start, end, src, pos, dest, prop; | 1415 | Lisp_Object start, end, src, pos, dest, prop; |
| @@ -1717,6 +1767,8 @@ This also inhibits the use of the `intangible' text property."); | |||
| 1717 | defsubr (&Stext_properties_at); | 1767 | defsubr (&Stext_properties_at); |
| 1718 | defsubr (&Sget_text_property); | 1768 | defsubr (&Sget_text_property); |
| 1719 | defsubr (&Sget_char_property); | 1769 | defsubr (&Sget_char_property); |
| 1770 | defsubr (&Snext_char_property_change); | ||
| 1771 | defsubr (&Sprevious_char_property_change); | ||
| 1720 | defsubr (&Snext_property_change); | 1772 | defsubr (&Snext_property_change); |
| 1721 | defsubr (&Snext_single_property_change); | 1773 | defsubr (&Snext_single_property_change); |
| 1722 | defsubr (&Sprevious_property_change); | 1774 | defsubr (&Sprevious_property_change); |