comparison src/textprop.c @ 90399:a5812696f7bf unicode-pre-font-backend

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 274-284) - Update from CVS - Update etc/MORE.STUFF. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 101) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-62
author Miles Bader <miles@gnu.org>
date Wed, 17 May 2006 07:46:49 +0000
parents 72dea2ff0142 182680a57573
children 138ce2701550
comparison
equal deleted inserted replaced
90398:1f8d5cd37cf0 90399:a5812696f7bf
715 Snext_char_property_change, 1, 2, 0, 715 Snext_char_property_change, 1, 2, 0,
716 doc: /* Return the position of next text property or overlay change. 716 doc: /* Return the position of next text property or overlay change.
717 This scans characters forward in the current buffer from POSITION till 717 This scans characters forward in the current buffer from POSITION till
718 it finds a change in some text property, or the beginning or end of an 718 it finds a change in some text property, or the beginning or end of an
719 overlay, and returns the position of that. 719 overlay, and returns the position of that.
720 If none is found, the function returns (point-max). 720 If none is found up to (point-max), the function returns (point-max).
721 721
722 If the optional second argument LIMIT is non-nil, don't search 722 If the optional second argument LIMIT is non-nil, don't search
723 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) 723 past position LIMIT; return LIMIT if nothing is found before LIMIT.
724 LIMIT is a no-op if it is greater than (point-max). */)
724 (position, limit) 725 (position, limit)
725 Lisp_Object position, limit; 726 Lisp_Object position, limit;
726 { 727 {
727 Lisp_Object temp; 728 Lisp_Object temp;
728 729
740 Sprevious_char_property_change, 1, 2, 0, 741 Sprevious_char_property_change, 1, 2, 0,
741 doc: /* Return the position of previous text property or overlay change. 742 doc: /* Return the position of previous text property or overlay change.
742 Scans characters backward in the current buffer from POSITION till it 743 Scans characters backward in the current buffer from POSITION till it
743 finds a change in some text property, or the beginning or end of an 744 finds a change in some text property, or the beginning or end of an
744 overlay, and returns the position of that. 745 overlay, and returns the position of that.
745 If none is found, the function returns (point-max). 746 If none is found since (point-min), the function returns (point-min).
746 747
747 If the optional second argument LIMIT is non-nil, don't search 748 If the optional second argument LIMIT is non-nil, don't search
748 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) 749 past position LIMIT; return LIMIT if nothing is found before LIMIT.
750 LIMIT is a no-op if it is less than (point-min). */)
749 (position, limit) 751 (position, limit)
750 Lisp_Object position, limit; 752 Lisp_Object position, limit;
751 { 753 {
752 Lisp_Object temp; 754 Lisp_Object temp;
753 755
769 a change in the PROP property, then returns the position of the change. 771 a change in the PROP property, then returns the position of the change.
770 If the optional third argument OBJECT is a buffer (or nil, which means 772 If the optional third argument OBJECT is a buffer (or nil, which means
771 the current buffer), POSITION is a buffer position (integer or marker). 773 the current buffer), POSITION is a buffer position (integer or marker).
772 If OBJECT is a string, POSITION is a 0-based index into it. 774 If OBJECT is a string, POSITION is a 0-based index into it.
773 775
776 In a string, scan runs to the end of the string.
777 In a buffer, it runs to (point-max), and the value cannot exceed that.
778
774 The property values are compared with `eq'. 779 The property values are compared with `eq'.
775 If the property is constant all the way to the end of OBJECT, return the 780 If the property is constant all the way to the end of OBJECT, return the
776 last valid position in OBJECT. 781 last valid position in OBJECT.
777 If the optional fourth argument LIMIT is non-nil, don't search 782 If the optional fourth argument LIMIT is non-nil, don't search
778 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) 783 past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
810 CHECK_NUMBER_COERCE_MARKER (position); 815 CHECK_NUMBER_COERCE_MARKER (position);
811 816
812 initial_value = Fget_char_property (position, prop, object); 817 initial_value = Fget_char_property (position, prop, object);
813 818
814 if (NILP (limit)) 819 if (NILP (limit))
815 XSETFASTINT (limit, BUF_ZV (current_buffer)); 820 XSETFASTINT (limit, ZV);
816 else 821 else
817 CHECK_NUMBER_COERCE_MARKER (limit); 822 CHECK_NUMBER_COERCE_MARKER (limit);
818 823
819 for (;;) 824 if (XFASTINT (position) >= XFASTINT (limit))
820 { 825 {
821 position = Fnext_char_property_change (position, limit); 826 position = limit;
822 if (XFASTINT (position) >= XFASTINT (limit)) { 827 if (XFASTINT (position) > ZV)
823 position = limit; 828 XSETFASTINT (position, ZV);
824 break; 829 }
830 else
831 while (1)
832 {
833 position = Fnext_char_property_change (position, limit);
834 if (XFASTINT (position) >= XFASTINT (limit))
835 {
836 position = limit;
837 break;
838 }
839
840 value = Fget_char_property (position, prop, object);
841 if (!EQ (value, initial_value))
842 break;
825 } 843 }
826
827 value = Fget_char_property (position, prop, object);
828 if (!EQ (value, initial_value))
829 break;
830 }
831 844
832 unbind_to (count, Qnil); 845 unbind_to (count, Qnil);
833 } 846 }
834 847
835 return position; 848 return position;
843 a change in the PROP property, then returns the position of the change. 856 a change in the PROP property, then returns the position of the change.
844 If the optional third argument OBJECT is a buffer (or nil, which means 857 If the optional third argument OBJECT is a buffer (or nil, which means
845 the current buffer), POSITION is a buffer position (integer or marker). 858 the current buffer), POSITION is a buffer position (integer or marker).
846 If OBJECT is a string, POSITION is a 0-based index into it. 859 If OBJECT is a string, POSITION is a 0-based index into it.
847 860
861 In a string, scan runs to the start of the string.
862 In a buffer, it runs to (point-min), and the value cannot be less than that.
863
848 The property values are compared with `eq'. 864 The property values are compared with `eq'.
849 If the property is constant all the way to the start of OBJECT, return the 865 If the property is constant all the way to the start of OBJECT, return the
850 first valid position in OBJECT. 866 first valid position in OBJECT.
851 If the optional fourth argument LIMIT is non-nil, don't search 867 If the optional fourth argument LIMIT is non-nil, don't search
852 back past position LIMIT; return LIMIT if nothing is found before LIMIT. */) 868 back past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
881 } 897 }
882 898
883 CHECK_NUMBER_COERCE_MARKER (position); 899 CHECK_NUMBER_COERCE_MARKER (position);
884 900
885 if (NILP (limit)) 901 if (NILP (limit))
886 XSETFASTINT (limit, BUF_BEGV (current_buffer)); 902 XSETFASTINT (limit, BEGV);
887 else 903 else
888 CHECK_NUMBER_COERCE_MARKER (limit); 904 CHECK_NUMBER_COERCE_MARKER (limit);
889 905
890 if (XFASTINT (position) <= XFASTINT (limit)) 906 if (XFASTINT (position) <= XFASTINT (limit))
891 position = limit; 907 {
908 position = limit;
909 if (XFASTINT (position) < BEGV)
910 XSETFASTINT (position, BEGV);
911 }
892 else 912 else
893 { 913 {
894 Lisp_Object initial_value = 914 Lisp_Object initial_value
895 Fget_char_property (make_number (XFASTINT (position) - 1), 915 = Fget_char_property (make_number (XFASTINT (position) - 1),
896 prop, object); 916 prop, object);
897 917
898 for (;;) 918 while (1)
899 { 919 {
900 position = Fprevious_char_property_change (position, limit); 920 position = Fprevious_char_property_change (position, limit);
901 921
902 if (XFASTINT (position) <= XFASTINT (limit)) 922 if (XFASTINT (position) <= XFASTINT (limit))
903 { 923 {
904 position = limit; 924 position = limit;
905 break; 925 break;
906 } 926 }
907 else 927 else
908 { 928 {
909 Lisp_Object value = 929 Lisp_Object value
910 Fget_char_property (make_number (XFASTINT (position) - 1), 930 = Fget_char_property (make_number (XFASTINT (position) - 1),
911 prop, object); 931 prop, object);
912 932
913 if (!EQ (value, initial_value)) 933 if (!EQ (value, initial_value))
914 break; 934 break;
915 } 935 }
916 } 936 }