aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann1999-09-26 10:53:22 +0000
committerGerd Moellmann1999-09-26 10:53:22 +0000
commit0b0737d1c74782f08b9bf8b48783545bc8bb318d (patch)
tree7df7a7fa6e44d44888d19485ae9fbb17b4c16113 /src
parent50075fa036e466a4d9bb3845eb62b2e4899c0d01 (diff)
downloademacs-0b0737d1c74782f08b9bf8b48783545bc8bb318d.tar.gz
emacs-0b0737d1c74782f08b9bf8b48783545bc8bb318d.zip
(next_single_char_property_change): New.
Diffstat (limited to 'src')
-rw-r--r--src/textprop.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/textprop.c b/src/textprop.c
index bd877073e49..14cebd69d64 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -675,6 +675,60 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT.")
675 } 675 }
676 return Fprevious_property_change (position, Qnil, temp); 676 return Fprevious_property_change (position, Qnil, temp);
677} 677}
678
679
680/* Value is the position in OBJECT after POS where the value of
681 property PROP changes. OBJECT must be a string or buffer. If
682 OBJECT is nil, use the current buffer. LIMIT if not nil limits the
683 search. */
684
685Lisp_Object
686next_single_char_property_change (pos, prop, object, limit)
687 Lisp_Object prop, pos, object, limit;
688{
689 if (STRINGP (object))
690 {
691 pos = Fnext_single_property_change (pos, prop, object, limit);
692 if (NILP (pos))
693 {
694 if (NILP (limit))
695 pos = make_number (XSTRING (object)->size);
696 else
697 pos = limit;
698 }
699 }
700 else
701 {
702 Lisp_Object initial_value, value;
703 struct buffer *old_current_buffer = NULL;
704 int count = specpdl_ptr - specpdl;
705
706 if (!NILP (object))
707 CHECK_BUFFER (object, 0);
708
709 if (BUFFERP (object) && current_buffer != XBUFFER (object))
710 {
711 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
712 Fset_buffer (object);
713 }
714
715 initial_value = Fget_char_property (pos, prop, object);
716
717 while (XFASTINT (pos) < XFASTINT (limit))
718 {
719 pos = Fnext_char_property_change (pos, limit);
720 value = Fget_char_property (pos, prop, object);
721 if (!EQ (value, initial_value))
722 break;
723 }
724
725 unbind_to (count, Qnil);
726 }
727
728 return pos;
729}
730
731
678 732
679DEFUN ("next-property-change", Fnext_property_change, 733DEFUN ("next-property-change", Fnext_property_change,
680 Snext_property_change, 1, 3, 0, 734 Snext_property_change, 1, 3, 0,