/[emacs]/emacs/src/textprop.c
ViewVC logotype

Diff of /emacs/src/textprop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.128 by walters, Sat Jun 8 20:24:35 2002 UTC revision 1.128.2.1 by miles, Fri Apr 4 06:21:03 2003 UTC
# Line 83  Lisp_Object interval_insert_in_front_hoo Line 83  Lisp_Object interval_insert_in_front_hoo
83     to capture that error in GDB by putting a breakpoint on it.  */     to capture that error in GDB by putting a breakpoint on it.  */
84    
85  static void  static void
86  text_read_only ()  text_read_only (propval)
87         Lisp_Object propval;
88  {  {
89    Fsignal (Qtext_read_only, Qnil);    Fsignal (Qtext_read_only, STRINGP (propval) ? Fcons (propval, Qnil) : Qnil);
90  }  }
91    
92    
# Line 158  validate_interval_range (object, begin, Line 159  validate_interval_range (object, begin,
159      }      }
160    else    else
161      {      {
162        register struct Lisp_String *s = XSTRING (object);        int len = SCHARS (object);
163    
164        if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end)        if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end)
165               && XINT (*end) <= s->size))               && XINT (*end) <= len))
166          args_out_of_range (*begin, *end);          args_out_of_range (*begin, *end);
167        XSETFASTINT (*begin, XFASTINT (*begin));        XSETFASTINT (*begin, XFASTINT (*begin));
168        if (begin != end)        if (begin != end)
169          XSETFASTINT (*end, XFASTINT (*end));          XSETFASTINT (*end, XFASTINT (*end));
170        i = s->intervals;        i = STRING_INTERVALS (object);
171    
172        if (s->size == 0)        if (len == 0)
173          return NULL_INTERVAL;          return NULL_INTERVAL;
174    
175        searchpos = XINT (*begin);        searchpos = XINT (*begin);
# Line 176  validate_interval_range (object, begin, Line 177  validate_interval_range (object, begin,
177    
178    if (NULL_INTERVAL_P (i))    if (NULL_INTERVAL_P (i))
179      return (force ? create_root_interval (object) : i);      return (force ? create_root_interval (object) : i);
180        
181    return find_interval (i, searchpos);    return find_interval (i, searchpos);
182  }  }
183    
# Line 525  erase_properties (i) Line 526  erase_properties (i)
526  }  }
527  #endif  #endif
528    
529  /* Returns the interval of POSITION in OBJECT.  /* Returns the interval of POSITION in OBJECT.
530     POSITION is BEG-based.  */     POSITION is BEG-based.  */
531    
532  INTERVAL  INTERVAL
# Line 553  interval_of (position, object) Line 554  interval_of (position, object)
554      }      }
555    else    else
556      {      {
       register struct Lisp_String *s = XSTRING (object);  
   
557        beg = 0;        beg = 0;
558        end = s->size;        end = SCHARS (object);
559        i = s->intervals;        i = STRING_INTERVALS (object);
560      }      }
561    
562    if (!(beg <= position && position <= end))    if (!(beg <= position && position <= end))
563      args_out_of_range (make_number (position), make_number (position));      args_out_of_range (make_number (position), make_number (position));
564    if (beg == end || NULL_INTERVAL_P (i))    if (beg == end || NULL_INTERVAL_P (i))
565      return NULL_INTERVAL;      return NULL_INTERVAL;
566        
567    return find_interval (i, position);    return find_interval (i, position);
568  }  }
569    
570  DEFUN ("text-properties-at", Ftext_properties_at,  DEFUN ("text-properties-at", Ftext_properties_at,
571         Stext_properties_at, 1, 2, 0,         Stext_properties_at, 1, 2, 0,
572         doc: /* Return the list of properties of the character at POSITION in OBJECT.         doc: /* Return the list of properties of the character at POSITION in OBJECT.
573  OBJECT is the string or buffer to look for the properties in;  If the optional second argument OBJECT is a buffer (or nil, which means
574  nil means the current buffer.  the current buffer), POSITION is a buffer position (integer or marker).
575    If OBJECT is a string, POSITION is a 0-based index into it.
576  If POSITION is at the end of OBJECT, the value is nil.  */)  If POSITION is at the end of OBJECT, the value is nil.  */)
577       (position, object)       (position, object)
578       Lisp_Object position, object;       Lisp_Object position, object;
# Line 606  If POSITION is at the end of OBJECT, the Line 606  If POSITION is at the end of OBJECT, the
606    return textget (Ftext_properties_at (position, object), prop);    return textget (Ftext_properties_at (position, object), prop);
607  }  }
608    
609  /* Return the value of POSITION's property PROP, in OBJECT.  /* Return the value of char's property PROP, in OBJECT at POSITION.
610     OBJECT is optional and defaults to the current buffer.     OBJECT is optional and defaults to the current buffer.
611     If OVERLAY is non-0, then in the case that the returned property is from     If OVERLAY is non-0, then in the case that the returned property is from
612     an overlay, the overlay found is returned in *OVERLAY, otherwise nil is     an overlay, the overlay found is returned in *OVERLAY, otherwise nil is
# Line 640  get_char_property_and_overlay (position, Line 640  get_char_property_and_overlay (position,
640        int posn = XINT (position);        int posn = XINT (position);
641        int noverlays;        int noverlays;
642        Lisp_Object *overlay_vec, tem;        Lisp_Object *overlay_vec, tem;
       int next_overlay;  
643        int len;        int len;
644        struct buffer *obuf = current_buffer;        struct buffer *obuf = current_buffer;
645    
# Line 651  get_char_property_and_overlay (position, Line 650  get_char_property_and_overlay (position,
650        overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));        overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
651    
652        noverlays = overlays_at (posn, 0, &overlay_vec, &len,        noverlays = overlays_at (posn, 0, &overlay_vec, &len,
653                                 &next_overlay, NULL, 0);                                 NULL, NULL, 0);
654    
655        /* If there are more than 40,        /* If there are more than 40,
656           make enough space for all, and try again.  */           make enough space for all, and try again.  */
# Line 660  get_char_property_and_overlay (position, Line 659  get_char_property_and_overlay (position,
659            len = noverlays;            len = noverlays;
660            overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));            overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
661            noverlays = overlays_at (posn, 0, &overlay_vec, &len,            noverlays = overlays_at (posn, 0, &overlay_vec, &len,
662                                     &next_overlay, NULL, 0);                                     NULL, NULL, 0);
663          }          }
664        noverlays = sort_overlays (overlay_vec, noverlays, w);        noverlays = sort_overlays (overlay_vec, noverlays, w);
665    
# Line 708  overlays are considered only if they are Line 707  overlays are considered only if they are
707  DEFUN ("next-char-property-change", Fnext_char_property_change,  DEFUN ("next-char-property-change", Fnext_char_property_change,
708         Snext_char_property_change, 1, 2, 0,         Snext_char_property_change, 1, 2, 0,
709         doc: /* Return the position of next text property or overlay change.         doc: /* Return the position of next text property or overlay change.
710  This scans characters forward from POSITION till it finds a change in  This scans characters forward in the current buffer from POSITION till
711  some text property, or the beginning or end of an overlay, and returns  it finds a change in some text property, or the beginning or end of an
712  the position of that.  overlay, and returns the position of that.
713  If none is found, the function returns (point-max).  If none is found, the function returns (point-max).
714    
715  If the optional third argument LIMIT is non-nil, don't search  If the optional third argument LIMIT is non-nil, don't search
# Line 733  past position LIMIT; return LIMIT if not Line 732  past position LIMIT; return LIMIT if not
732  DEFUN ("previous-char-property-change", Fprevious_char_property_change,  DEFUN ("previous-char-property-change", Fprevious_char_property_change,
733         Sprevious_char_property_change, 1, 2, 0,         Sprevious_char_property_change, 1, 2, 0,
734         doc: /* Return the position of previous text property or overlay change.         doc: /* Return the position of previous text property or overlay change.
735  Scans characters backward from POSITION till it finds a change in some  Scans characters backward in the current buffer from POSITION till it
736  text property, or the beginning or end of an overlay, and returns the  finds a change in some text property, or the beginning or end of an
737  position of that.  overlay, and returns the position of that.
738  If none is found, the function returns (point-max).  If none is found, the function returns (point-max).
739    
740  If the optional third argument LIMIT is non-nil, don't search  If the optional third argument LIMIT is non-nil, don't search
# Line 761  DEFUN ("next-single-char-property-change Line 760  DEFUN ("next-single-char-property-change
760         doc: /* Return the position of next text property or overlay change for a specific property.         doc: /* Return the position of next text property or overlay change for a specific property.
761  Scans characters forward from POSITION till it finds  Scans characters forward from POSITION till it finds
762  a change in the PROP property, then returns the position of the change.  a change in the PROP property, then returns the position of the change.
763  The optional third argument OBJECT is the string or buffer to scan.  If the optional third argument OBJECT is a buffer (or nil, which means
764    the current buffer), POSITION is a buffer position (integer or marker).
765    If OBJECT is a string, POSITION is a 0-based index into it.
766    
767  The property values are compared with `eq'.  The property values are compared with `eq'.
768  If the property is constant all the way to the end of OBJECT, return the  If the property is constant all the way to the end of OBJECT, return the
769  last valid position in OBJECT.  last valid position in OBJECT.
# Line 776  past position LIMIT; return LIMIT if not Line 778  past position LIMIT; return LIMIT if not
778        if (NILP (position))        if (NILP (position))
779          {          {
780            if (NILP (limit))            if (NILP (limit))
781              position = make_number (XSTRING (object)->size);              position = make_number (SCHARS (object));
782            else            else
783              position = limit;              position = limit;
784          }          }
# Line 784  past position LIMIT; return LIMIT if not Line 786  past position LIMIT; return LIMIT if not
786    else    else
787      {      {
788        Lisp_Object initial_value, value;        Lisp_Object initial_value, value;
789        int count = specpdl_ptr - specpdl;        int count = SPECPDL_INDEX ();
790    
791        if (! NILP (object))        if (! NILP (object))
792          CHECK_BUFFER (object);          CHECK_BUFFER (object);
793          
794        if (BUFFERP (object) && current_buffer != XBUFFER (object))        if (BUFFERP (object) && current_buffer != XBUFFER (object))
795          {          {
796            record_unwind_protect (Fset_buffer, Fcurrent_buffer ());            record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
# Line 796  past position LIMIT; return LIMIT if not Line 798  past position LIMIT; return LIMIT if not
798          }          }
799    
800        initial_value = Fget_char_property (position, prop, object);        initial_value = Fget_char_property (position, prop, object);
801          
802        if (NILP (limit))        if (NILP (limit))
803          XSETFASTINT (limit, BUF_ZV (current_buffer));          XSETFASTINT (limit, BUF_ZV (current_buffer));
804        else        else
# Line 827  DEFUN ("previous-single-char-property-ch Line 829  DEFUN ("previous-single-char-property-ch
829         doc: /* Return the position of previous text property or overlay change for a specific property.         doc: /* Return the position of previous text property or overlay change for a specific property.
830  Scans characters backward from POSITION till it finds  Scans characters backward from POSITION till it finds
831  a change in the PROP property, then returns the position of the change.  a change in the PROP property, then returns the position of the change.
832  The optional third argument OBJECT is the string or buffer to scan.  If the optional third argument OBJECT is a buffer (or nil, which means
833    the current buffer), POSITION is a buffer position (integer or marker).
834    If OBJECT is a string, POSITION is a 0-based index into it.
835    
836  The property values are compared with `eq'.  The property values are compared with `eq'.
837  If the property is constant all the way to the start of OBJECT, return the  If the property is constant all the way to the start of OBJECT, return the
838  first valid position in OBJECT.  first valid position in OBJECT.
# Line 842  back past position LIMIT; return LIMIT i Line 847  back past position LIMIT; return LIMIT i
847        if (NILP (position))        if (NILP (position))
848          {          {
849            if (NILP (limit))            if (NILP (limit))
850              position = make_number (XSTRING (object)->size);              position = make_number (SCHARS (object));
851            else            else
852              position = limit;              position = limit;
853          }          }
854      }      }
855    else    else
856      {      {
857        int count = specpdl_ptr - specpdl;        int count = SPECPDL_INDEX ();
858    
859        if (! NILP (object))        if (! NILP (object))
860          CHECK_BUFFER (object);          CHECK_BUFFER (object);
861          
862        if (BUFFERP (object) && current_buffer != XBUFFER (object))        if (BUFFERP (object) && current_buffer != XBUFFER (object))
863          {          {
864            record_unwind_protect (Fset_buffer, Fcurrent_buffer ());            record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
865            Fset_buffer (object);            Fset_buffer (object);
866          }          }
867          
868        if (NILP (limit))        if (NILP (limit))
869          XSETFASTINT (limit, BUF_BEGV (current_buffer));          XSETFASTINT (limit, BUF_BEGV (current_buffer));
870        else        else
# Line 872  back past position LIMIT; return LIMIT i Line 877  back past position LIMIT; return LIMIT i
877            Lisp_Object initial_value =            Lisp_Object initial_value =
878              Fget_char_property (make_number (XFASTINT (position) - 1),              Fget_char_property (make_number (XFASTINT (position) - 1),
879                                  prop, object);                                  prop, object);
880          
881            for (;;)            for (;;)
882              {              {
883                position = Fprevious_char_property_change (position, limit);                position = Fprevious_char_property_change (position, limit);
# Line 905  DEFUN ("next-property-change", Fnext_pro Line 910  DEFUN ("next-property-change", Fnext_pro
910         doc: /* Return the position of next property change.         doc: /* Return the position of next property change.
911  Scans characters forward from POSITION in OBJECT till it finds  Scans characters forward from POSITION in OBJECT till it finds
912  a change in some text property, then returns the position of the change.  a change in some text property, then returns the position of the change.
913  The optional second argument OBJECT is the string or buffer to scan.  If the optional second argument OBJECT is a buffer (or nil, which means
914    the current buffer), POSITION is a buffer position (integer or marker).
915    If OBJECT is a string, POSITION is a 0-based index into it.
916  Return nil if the property is constant all the way to the end of OBJECT.  Return nil if the property is constant all the way to the end of OBJECT.
917  If the value is non-nil, it is a position greater than POSITION, never equal.  If the value is non-nil, it is a position greater than POSITION, never equal.
918    
# Line 932  past position LIMIT; return LIMIT if not Line 939  past position LIMIT; return LIMIT if not
939          next = i;          next = i;
940        else        else
941          next = next_interval (i);          next = next_interval (i);
942            
943        if (NULL_INTERVAL_P (next))        if (NULL_INTERVAL_P (next))
944          XSETFASTINT (position, (STRINGP (object)          XSETFASTINT (position, (STRINGP (object)
945                                  ? XSTRING (object)->size                                  ? SCHARS (object)
946                                  : BUF_ZV (XBUFFER (object))));                                  : BUF_ZV (XBUFFER (object))));
947        else        else
948          XSETFASTINT (position, next->position);          XSETFASTINT (position, next->position);
# Line 955  past position LIMIT; return LIMIT if not Line 962  past position LIMIT; return LIMIT if not
962      return limit;      return limit;
963    if (NILP (limit))    if (NILP (limit))
964      XSETFASTINT (limit, (STRINGP (object)      XSETFASTINT (limit, (STRINGP (object)
965                           ? XSTRING (object)->size                           ? SCHARS (object)
966                           : BUF_ZV (XBUFFER (object))));                           : BUF_ZV (XBUFFER (object))));
967    if (!(next->position < XFASTINT (limit)))    if (!(next->position < XFASTINT (limit)))
968      return limit;      return limit;
# Line 1001  DEFUN ("next-single-property-change", Fn Line 1008  DEFUN ("next-single-property-change", Fn
1008         doc: /* Return the position of next property change for a specific property.         doc: /* Return the position of next property change for a specific property.
1009  Scans characters forward from POSITION till it finds  Scans characters forward from POSITION till it finds
1010  a change in the PROP property, then returns the position of the change.  a change in the PROP property, then returns the position of the change.
1011  The optional third argument OBJECT is the string or buffer to scan.  If the optional third argument OBJECT is a buffer (or nil, which means
1012    the current buffer), POSITION is a buffer position (integer or marker).
1013    If OBJECT is a string, POSITION is a 0-based index into it.
1014  The property values are compared with `eq'.  The property values are compared with `eq'.
1015  Return nil if the property is constant all the way to the end of OBJECT.  Return nil if the property is constant all the way to the end of OBJECT.
1016  If the value is non-nil, it is a position greater than POSITION, never equal.  If the value is non-nil, it is a position greater than POSITION, never equal.
# Line 1026  past position LIMIT; return LIMIT if not Line 1035  past position LIMIT; return LIMIT if not
1035    
1036    here_val = textget (i->plist, prop);    here_val = textget (i->plist, prop);
1037    next = next_interval (i);    next = next_interval (i);
1038    while (! NULL_INTERVAL_P (next)    while (! NULL_INTERVAL_P (next)
1039           && EQ (here_val, textget (next->plist, prop))           && EQ (here_val, textget (next->plist, prop))
1040           && (NILP (limit) || next->position < XFASTINT (limit)))           && (NILP (limit) || next->position < XFASTINT (limit)))
1041      next = next_interval (next);      next = next_interval (next);
# Line 1035  past position LIMIT; return LIMIT if not Line 1044  past position LIMIT; return LIMIT if not
1044      return limit;      return limit;
1045    if (NILP (limit))    if (NILP (limit))
1046      XSETFASTINT (limit, (STRINGP (object)      XSETFASTINT (limit, (STRINGP (object)
1047                           ? XSTRING (object)->size                           ? SCHARS (object)
1048                           : BUF_ZV (XBUFFER (object))));                           : BUF_ZV (XBUFFER (object))));
1049    if (!(next->position < XFASTINT (limit)))    if (!(next->position < XFASTINT (limit)))
1050      return limit;      return limit;
# Line 1048  DEFUN ("previous-property-change", Fprev Line 1057  DEFUN ("previous-property-change", Fprev
1057         doc: /* Return the position of previous property change.         doc: /* Return the position of previous property change.
1058  Scans characters backwards from POSITION in OBJECT till it finds  Scans characters backwards from POSITION in OBJECT till it finds
1059  a change in some text property, then returns the position of the change.  a change in some text property, then returns the position of the change.
1060  The optional second argument OBJECT is the string or buffer to scan.  If the optional second argument OBJECT is a buffer (or nil, which means
1061    the current buffer), POSITION is a buffer position (integer or marker).
1062    If OBJECT is a string, POSITION is a 0-based index into it.
1063  Return nil if the property is constant all the way to the start of OBJECT.  Return nil if the property is constant all the way to the start of OBJECT.
1064  If the value is non-nil, it is a position less than POSITION, never equal.  If the value is non-nil, it is a position less than POSITION, never equal.
1065    
# Line 1093  DEFUN ("previous-single-property-change" Line 1104  DEFUN ("previous-single-property-change"
1104         doc: /* Return the position of previous property change for a specific property.         doc: /* Return the position of previous property change for a specific property.
1105  Scans characters backward from POSITION till it finds  Scans characters backward from POSITION till it finds
1106  a change in the PROP property, then returns the position of the change.  a change in the PROP property, then returns the position of the change.
1107  The optional third argument OBJECT is the string or buffer to scan.  If the optional third argument OBJECT is a buffer (or nil, which means
1108    the current buffer), POSITION is a buffer position (integer or marker).
1109    If OBJECT is a string, POSITION is a 0-based index into it.
1110  The property values are compared with `eq'.  The property values are compared with `eq'.
1111  Return nil if the property is constant all the way to the start of OBJECT.  Return nil if the property is constant all the way to the start of OBJECT.
1112  If the value is non-nil, it is a position less than POSITION, never equal.  If the value is non-nil, it is a position less than POSITION, never equal.
# Line 1144  DEFUN ("add-text-properties", Fadd_text_ Line 1157  DEFUN ("add-text-properties", Fadd_text_
1157         Sadd_text_properties, 3, 4, 0,         Sadd_text_properties, 3, 4, 0,
1158         doc: /* Add properties to the text from START to END.         doc: /* Add properties to the text from START to END.
1159  The third argument PROPERTIES is a property list  The third argument PROPERTIES is a property list
1160  specifying the property values to add.  specifying the property values to add.  If the optional fourth argument
1161  The optional fourth argument, OBJECT,  OBJECT is a buffer (or nil, which means the current buffer),
1162  is the string or buffer containing the text.  START and END are buffer positions (integers or markers).
1163    If OBJECT is a string, START and END are 0-based indices into it.
1164  Return t if any property value actually changed, nil otherwise.  */)  Return t if any property value actually changed, nil otherwise.  */)
1165       (start, end, properties, object)       (start, end, properties, object)
1166       Lisp_Object start, end, properties, object;       Lisp_Object start, end, properties, object;
# Line 1253  DEFUN ("put-text-property", Fput_text_pr Line 1267  DEFUN ("put-text-property", Fput_text_pr
1267         doc: /* Set one property of the text from START to END.         doc: /* Set one property of the text from START to END.
1268  The third and fourth arguments PROPERTY and VALUE  The third and fourth arguments PROPERTY and VALUE
1269  specify the property to add.  specify the property to add.
1270  The optional fifth argument, OBJECT,  If the optional fifth argument OBJECT is a buffer (or nil, which means
1271  is the string or buffer containing the text.  */)  the current buffer), START and END are buffer positions (integers or
1272    markers).  If OBJECT is a string, START and END are 0-based indices into it.  */)
1273       (start, end, property, value, object)       (start, end, property, value, object)
1274       Lisp_Object start, end, property, value, object;       Lisp_Object start, end, property, value, object;
1275  {  {
# Line 1268  DEFUN ("set-text-properties", Fset_text_ Line 1283  DEFUN ("set-text-properties", Fset_text_
1283         Sset_text_properties, 3, 4, 0,         Sset_text_properties, 3, 4, 0,
1284         doc: /* Completely replace properties of text from START to END.         doc: /* Completely replace properties of text from START to END.
1285  The third argument PROPERTIES is the new property list.  The third argument PROPERTIES is the new property list.
1286  The optional fourth argument, OBJECT,  If the optional fourth argument OBJECT is a buffer (or nil, which means
1287  is the string or buffer containing the text.  the current buffer), START and END are buffer positions (integers or
1288  If OBJECT is omitted or nil, it defaults to the current buffer.  markers).  If OBJECT is a string, START and END are 0-based indices into it.
1289  If PROPERTIES is nil, the effect is to remove all properties from  If PROPERTIES is nil, the effect is to remove all properties from
1290  the designated part of OBJECT.  */)  the designated part of OBJECT.  */)
1291       (start, end, properties, object)       (start, end, properties, object)
# Line 1306  set_text_properties (start, end, propert Line 1321  set_text_properties (start, end, propert
1321       get rid of its intervals.  */       get rid of its intervals.  */
1322    if (NILP (properties) && STRINGP (object)    if (NILP (properties) && STRINGP (object)
1323        && XFASTINT (start) == 0        && XFASTINT (start) == 0
1324        && XFASTINT (end) == XSTRING (object)->size)        && XFASTINT (end) == SCHARS (object))
1325      {      {
1326        if (! XSTRING (object)->intervals)        if (! STRING_INTERVALS (object))
1327          return Qt;          return Qt;
1328    
1329        XSTRING (object)->intervals = 0;        STRING_SET_INTERVALS (object, NULL_INTERVAL);
1330        return Qt;        return Qt;
1331      }      }
1332    
# Line 1438  DEFUN ("remove-text-properties", Fremove Line 1453  DEFUN ("remove-text-properties", Fremove
1453  The third argument PROPERTIES is a property list  The third argument PROPERTIES is a property list
1454  whose property names specify the properties to remove.  whose property names specify the properties to remove.
1455  \(The values stored in PROPERTIES are ignored.)  \(The values stored in PROPERTIES are ignored.)
1456  The optional fourth argument, OBJECT,  If the optional fourth argument OBJECT is a buffer (or nil, which means
1457  is the string or buffer containing the text.  the current buffer), START and END are buffer positions (integers or
1458  Return t if any property was actually removed, nil otherwise.  */)  markers).  If OBJECT is a string, START and END are 0-based indices into it.
1459    Return t if any property was actually removed, nil otherwise.
1460    
1461    Use set-text-properties if you want to remove all text properties.  */)
1462       (start, end, properties, object)       (start, end, properties, object)
1463       Lisp_Object start, end, properties, object;       Lisp_Object start, end, properties, object;
1464  {  {
# Line 1523  DEFUN ("remove-list-of-text-properties", Line 1541  DEFUN ("remove-list-of-text-properties",
1541         Sremove_list_of_text_properties, 3, 4, 0,         Sremove_list_of_text_properties, 3, 4, 0,
1542         doc: /* Remove some properties from text from START to END.         doc: /* Remove some properties from text from START to END.
1543  The third argument LIST-OF-PROPERTIES is a list of property names to remove.  The third argument LIST-OF-PROPERTIES is a list of property names to remove.
1544  The optional fourth argument, OBJECT,  If the optional fourth argument OBJECT is a buffer (or nil, which means
1545  is the string or buffer containing the text, defaulting to the current buffer.  the current buffer), START and END are buffer positions (integers or
1546    markers).  If OBJECT is a string, START and END are 0-based indices into it.
1547  Return t if any property was actually removed, nil otherwise.  */)  Return t if any property was actually removed, nil otherwise.  */)
1548       (start, end, list_of_properties, object)       (start, end, list_of_properties, object)
1549       Lisp_Object start, end, list_of_properties, object;       Lisp_Object start, end, list_of_properties, object;
# Line 1611  DEFUN ("text-property-any", Ftext_proper Line 1630  DEFUN ("text-property-any", Ftext_proper
1630         doc: /* Check text from START to END for property PROPERTY equalling VALUE.         doc: /* Check text from START to END for property PROPERTY equalling VALUE.
1631  If so, return the position of the first character whose property PROPERTY  If so, return the position of the first character whose property PROPERTY
1632  is `eq' to VALUE.  Otherwise return nil.  is `eq' to VALUE.  Otherwise return nil.
1633  The optional fifth argument, OBJECT, is the string or buffer  If the optional fifth argument OBJECT is a buffer (or nil, which means
1634  containing the text.  */)  the current buffer), START and END are buffer positions (integers or
1635    markers).  If OBJECT is a string, START and END are 0-based indices into it.  */)
1636       (start, end, property, value, object)       (start, end, property, value, object)
1637       Lisp_Object start, end, property, value, object;       Lisp_Object start, end, property, value, object;
1638  {  {
# Line 1647  DEFUN ("text-property-not-all", Ftext_pr Line 1667  DEFUN ("text-property-not-all", Ftext_pr
1667         doc: /* Check text from START to END for property PROPERTY not equalling VALUE.         doc: /* Check text from START to END for property PROPERTY not equalling VALUE.
1668  If so, return the position of the first character whose property PROPERTY  If so, return the position of the first character whose property PROPERTY
1669  is not `eq' to VALUE.  Otherwise, return nil.  is not `eq' to VALUE.  Otherwise, return nil.
1670  The optional fifth argument, OBJECT, is the string or buffer  If the optional fifth argument OBJECT is a buffer (or nil, which means
1671  containing the text.  */)  the current buffer), START and END are buffer positions (integers or
1672    markers).  If OBJECT is a string, START and END are 0-based indices into it.  */)
1673       (start, end, property, value, object)       (start, end, property, value, object)
1674       Lisp_Object start, end, property, value, object;       Lisp_Object start, end, property, value, object;
1675  {  {
# Line 1852  text_property_list (object, start, end, Line 1873  text_property_list (object, start, end,
1873    Lisp_Object result;    Lisp_Object result;
1874    
1875    result = Qnil;    result = Qnil;
1876      
1877    i = validate_interval_range (object, &start, &end, soft);    i = validate_interval_range (object, &start, &end, soft);
1878    if (!NULL_INTERVAL_P (i))    if (!NULL_INTERVAL_P (i))
1879      {      {
1880        int s = XINT (start);        int s = XINT (start);
1881        int e = XINT (end);        int e = XINT (end);
1882          
1883        while (s < e)        while (s < e)
1884          {          {
1885            int interval_end, len;            int interval_end, len;
1886            Lisp_Object plist;            Lisp_Object plist;
1887              
1888            interval_end = i->position + LENGTH (i);            interval_end = i->position + LENGTH (i);
1889            if (interval_end > e)            if (interval_end > e)
1890              interval_end = e;              interval_end = e;
1891            len = interval_end - s;            len = interval_end - s;
1892              
1893            plist = i->plist;            plist = i->plist;
1894    
1895            if (!NILP (prop))            if (!NILP (prop))
# Line 1884  text_property_list (object, start, end, Line 1905  text_property_list (object, start, end,
1905                                     Fcons (make_number (s + len),                                     Fcons (make_number (s + len),
1906                                            Fcons (plist, Qnil))),                                            Fcons (plist, Qnil))),
1907                              result);                              result);
1908              
1909            i = next_interval (i);            i = next_interval (i);
1910            if (NULL_INTERVAL_P (i))            if (NULL_INTERVAL_P (i))
1911              break;              break;
1912            s = i->position;            s = i->position;
1913          }          }
1914      }      }
1915      
1916    return result;    return result;
1917  }  }
1918    
# Line 1908  add_text_properties_from_list (object, l Line 1929  add_text_properties_from_list (object, l
1929  {  {
1930    struct gcpro gcpro1, gcpro2;    struct gcpro gcpro1, gcpro2;
1931    int modified_p = 0;    int modified_p = 0;
1932      
1933    GCPRO2 (list, object);    GCPRO2 (list, object);
1934      
1935    for (; CONSP (list); list = XCDR (list))    for (; CONSP (list); list = XCDR (list))
1936      {      {
1937        Lisp_Object item, start, end, plist, tem;        Lisp_Object item, start, end, plist, tem;
1938          
1939        item = XCAR (list);        item = XCAR (list);
1940        start = make_number (XINT (XCAR (item)) + XINT (delta));        start = make_number (XINT (XCAR (item)) + XINT (delta));
1941        end = make_number (XINT (XCAR (XCDR (item))) + XINT (delta));        end = make_number (XINT (XCAR (XCDR (item))) + XINT (delta));
1942        plist = XCAR (XCDR (XCDR (item)));        plist = XCAR (XCDR (XCDR (item)));
1943          
1944        tem = Fadd_text_properties (start, end, plist, object);        tem = Fadd_text_properties (start, end, plist, object);
1945        if (!NILP (tem))        if (!NILP (tem))
1946          modified_p = 1;          modified_p = 1;
# Line 1942  extend_property_ranges (list, old_end, n Line 1963  extend_property_ranges (list, old_end, n
1963    for (; CONSP (list); list = XCDR (list))    for (; CONSP (list); list = XCDR (list))
1964      {      {
1965        Lisp_Object item, end;        Lisp_Object item, end;
1966          
1967        item = XCAR (list);        item = XCAR (list);
1968        end = XCAR (XCDR (item));        end = XCAR (XCDR (item));
1969    
# Line 2040  verify_interval_modification (buf, start Line 2061  verify_interval_modification (buf, start
2061                if (! NULL_INTERVAL_P (i))                if (! NULL_INTERVAL_P (i))
2062                  {                  {
2063                    after = textget (i->plist, Qread_only);                    after = textget (i->plist, Qread_only);
2064                      
2065                    /* If interval I is read-only and read-only is                    /* If interval I is read-only and read-only is
2066                       front-sticky, inhibit insertion.                       front-sticky, inhibit insertion.
2067                       Check for read-only as well as category.  */                       Check for read-only as well as category.  */
# Line 2053  verify_interval_modification (buf, start Line 2074  verify_interval_modification (buf, start
2074                        if (TMEM (Qread_only, tem)                        if (TMEM (Qread_only, tem)
2075                            || (NILP (Fplist_get (i->plist, Qread_only))                            || (NILP (Fplist_get (i->plist, Qread_only))
2076                                && TMEM (Qcategory, tem)))                                && TMEM (Qcategory, tem)))
2077                          text_read_only ();                          text_read_only (after);
2078                      }                      }
2079                  }                  }
2080    
2081                if (! NULL_INTERVAL_P (prev))                if (! NULL_INTERVAL_P (prev))
2082                  {                  {
2083                    before = textget (prev->plist, Qread_only);                    before = textget (prev->plist, Qread_only);
2084                      
2085                    /* If interval PREV is read-only and read-only isn't                    /* If interval PREV is read-only and read-only isn't
2086                       rear-nonsticky, inhibit insertion.                       rear-nonsticky, inhibit insertion.
2087                       Check for read-only as well as category.  */                       Check for read-only as well as category.  */
# Line 2073  verify_interval_modification (buf, start Line 2094  verify_interval_modification (buf, start
2094                        if (! TMEM (Qread_only, tem)                        if (! TMEM (Qread_only, tem)
2095                            && (! NILP (Fplist_get (prev->plist,Qread_only))                            && (! NILP (Fplist_get (prev->plist,Qread_only))
2096                                || ! TMEM (Qcategory, tem)))                                || ! TMEM (Qcategory, tem)))
2097                          text_read_only ();                          text_read_only (before);
2098                      }                      }
2099                  }                  }
2100              }              }
2101            else if (! NULL_INTERVAL_P (i))            else if (! NULL_INTERVAL_P (i))
2102              {              {
2103                after = textget (i->plist, Qread_only);                after = textget (i->plist, Qread_only);
2104                      
2105                /* If interval I is read-only and read-only is                /* If interval I is read-only and read-only is
2106                   front-sticky, inhibit insertion.                   front-sticky, inhibit insertion.
2107                   Check for read-only as well as category.  */                   Check for read-only as well as category.  */
# Line 2092  verify_interval_modification (buf, start Line 2113  verify_interval_modification (buf, start
2113                    if (TMEM (Qread_only, tem)                    if (TMEM (Qread_only, tem)
2114                        || (NILP (Fplist_get (i->plist, Qread_only))                        || (NILP (Fplist_get (i->plist, Qread_only))
2115                            && TMEM (Qcategory, tem)))                            && TMEM (Qcategory, tem)))
2116                      text_read_only ();                      text_read_only (after);
2117    
2118                    tem = textget (prev->plist, Qrear_nonsticky);                    tem = textget (prev->plist, Qrear_nonsticky);
2119                    if (! TMEM (Qread_only, tem)                    if (! TMEM (Qread_only, tem)
2120                        && (! NILP (Fplist_get (prev->plist, Qread_only))                        && (! NILP (Fplist_get (prev->plist, Qread_only))
2121                            || ! TMEM (Qcategory, tem)))                            || ! TMEM (Qcategory, tem)))
2122                      text_read_only ();                      text_read_only (after);
2123                  }                  }
2124              }              }
2125          }          }
# Line 2120  verify_interval_modification (buf, start Line 2141  verify_interval_modification (buf, start
2141        do        do
2142          {          {
2143            if (! INTERVAL_WRITABLE_P (i))            if (! INTERVAL_WRITABLE_P (i))
2144              text_read_only ();              text_read_only (textget (i->plist, Qread_only));
2145    
2146            if (!inhibit_modification_hooks)            if (!inhibit_modification_hooks)
2147              {              {
# Line 2208  rear-nonsticky properties of the charact Line 2229  rear-nonsticky properties of the charact
2229    interval_insert_behind_hooks = Qnil;    interval_insert_behind_hooks = Qnil;
2230    interval_insert_in_front_hooks = Qnil;    interval_insert_in_front_hooks = Qnil;
2231    
2232                  
2233    /* Common attributes one might give text */    /* Common attributes one might give text */
2234    
2235    staticpro (&Qforeground);    staticpro (&Qforeground);
# Line 2270  rear-nonsticky properties of the charact Line 2291  rear-nonsticky properties of the charact
2291  /*  defsubr (&Serase_text_properties); */  /*  defsubr (&Serase_text_properties); */
2292  /*  defsubr (&Scopy_text_properties); */  /*  defsubr (&Scopy_text_properties); */
2293  }  }
   

Legend:
Removed from v.1.128  
changed lines
  Added in v.1.128.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26