1 /* Interface code for dealing with text properties.
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
23 #include "intervals.h"
28 #define NULL (void *)0
31 /* Test for membership, allowing for t (actually any non-cons) to mean the
34 #define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set))
37 /* NOTES: previous- and next- property change will have to skip
38 zero-length intervals if they are implemented. This could be done
39 inside next_interval and previous_interval.
41 set_properties needs to deal with the interval property cache.
43 It is assumed that for any interval plist, a property appears
44 only once on the list. Although some code i.e., remove_properties,
45 handles the more general case, the uniqueness of properties is
46 necessary for the system to remain consistent. This requirement
47 is enforced by the subrs installing properties onto the intervals. */
49 /* The rest of the file is within this conditional */
50 #ifdef USE_TEXT_PROPERTIES
53 Lisp_Object Qmouse_left
;
54 Lisp_Object Qmouse_entered
;
55 Lisp_Object Qpoint_left
;
56 Lisp_Object Qpoint_entered
;
57 Lisp_Object Qcategory
;
58 Lisp_Object Qlocal_map
;
60 /* Visual properties text (including strings) may have. */
61 Lisp_Object Qforeground
, Qbackground
, Qfont
, Qunderline
, Qstipple
;
62 Lisp_Object Qinvisible
, Qread_only
, Qintangible
;
64 /* Sticky properties */
65 Lisp_Object Qfront_sticky
, Qrear_nonsticky
;
67 /* If o1 is a cons whose cdr is a cons, return non-zero and set o2 to
68 the o1's cdr. Otherwise, return zero. This is handy for
70 #define PLIST_ELT_P(o1, o2) (CONSP (o1) && ((o2)=XCONS (o1)->cdr, CONSP (o2)))
72 Lisp_Object Vinhibit_point_motion_hooks
;
73 Lisp_Object Vdefault_text_properties
;
75 /* verify_interval_modification saves insertion hooks here
76 to be run later by report_interval_modification. */
77 Lisp_Object interval_insert_behind_hooks
;
78 Lisp_Object interval_insert_in_front_hooks
;
80 /* Extract the interval at the position pointed to by BEGIN from
81 OBJECT, a string or buffer. Additionally, check that the positions
82 pointed to by BEGIN and END are within the bounds of OBJECT, and
83 reverse them if *BEGIN is greater than *END. The objects pointed
84 to by BEGIN and END may be integers or markers; if the latter, they
85 are coerced to integers.
87 When OBJECT is a string, we increment *BEGIN and *END
88 to make them origin-one.
90 Note that buffer points don't correspond to interval indices.
91 For example, point-max is 1 greater than the index of the last
92 character. This difference is handled in the caller, which uses
93 the validated points to determine a length, and operates on that.
94 Exceptions are Ftext_properties_at, Fnext_property_change, and
95 Fprevious_property_change which call this function with BEGIN == END.
96 Handle this case specially.
98 If FORCE is soft (0), it's OK to return NULL_INTERVAL. Otherwise,
99 create an interval tree for OBJECT if one doesn't exist, provided
100 the object actually contains text. In the current design, if there
101 is no text, there can be no text properties. */
107 validate_interval_range (object
, begin
, end
, force
)
108 Lisp_Object object
, *begin
, *end
;
114 CHECK_STRING_OR_BUFFER (object
, 0);
115 CHECK_NUMBER_COERCE_MARKER (*begin
, 0);
116 CHECK_NUMBER_COERCE_MARKER (*end
, 0);
118 /* If we are asked for a point, but from a subr which operates
119 on a range, then return nothing. */
120 if (EQ (*begin
, *end
) && begin
!= end
)
121 return NULL_INTERVAL
;
123 if (XINT (*begin
) > XINT (*end
))
131 if (BUFFERP (object
))
133 register struct buffer
*b
= XBUFFER (object
);
135 if (!(BUF_BEGV (b
) <= XINT (*begin
) && XINT (*begin
) <= XINT (*end
)
136 && XINT (*end
) <= BUF_ZV (b
)))
137 args_out_of_range (*begin
, *end
);
138 i
= BUF_INTERVALS (b
);
140 /* If there's no text, there are no properties. */
141 if (BUF_BEGV (b
) == BUF_ZV (b
))
142 return NULL_INTERVAL
;
144 searchpos
= XINT (*begin
);
148 register struct Lisp_String
*s
= XSTRING (object
);
150 if (! (0 <= XINT (*begin
) && XINT (*begin
) <= XINT (*end
)
151 && XINT (*end
) <= s
->size
))
152 args_out_of_range (*begin
, *end
);
153 /* User-level Positions in strings start with 0,
154 but the interval code always wants positions starting with 1. */
155 XSETFASTINT (*begin
, XFASTINT (*begin
) + 1);
157 XSETFASTINT (*end
, XFASTINT (*end
) + 1);
161 return NULL_INTERVAL
;
163 searchpos
= XINT (*begin
);
166 if (NULL_INTERVAL_P (i
))
167 return (force
? create_root_interval (object
) : i
);
169 return find_interval (i
, searchpos
);
172 /* Validate LIST as a property list. If LIST is not a list, then
173 make one consisting of (LIST nil). Otherwise, verify that LIST
174 is even numbered and thus suitable as a plist. */
177 validate_plist (list
)
186 register Lisp_Object tail
;
187 for (i
= 0, tail
= list
; !NILP (tail
); i
++)
193 error ("Odd length text property list");
197 return Fcons (list
, Fcons (Qnil
, Qnil
));
200 /* Return nonzero if interval I has all the properties,
201 with the same values, of list PLIST. */
204 interval_has_all_properties (plist
, i
)
208 register Lisp_Object tail1
, tail2
, sym1
, sym2
;
211 /* Go through each element of PLIST. */
212 for (tail1
= plist
; ! NILP (tail1
); tail1
= Fcdr (Fcdr (tail1
)))
217 /* Go through I's plist, looking for sym1 */
218 for (tail2
= i
->plist
; ! NILP (tail2
); tail2
= Fcdr (Fcdr (tail2
)))
219 if (EQ (sym1
, Fcar (tail2
)))
221 /* Found the same property on both lists. If the
222 values are unequal, return zero. */
223 if (! EQ (Fcar (Fcdr (tail1
)), Fcar (Fcdr (tail2
))))
226 /* Property has same value on both lists; go to next one. */
238 /* Return nonzero if the plist of interval I has any of the
239 properties of PLIST, regardless of their values. */
242 interval_has_some_properties (plist
, i
)
246 register Lisp_Object tail1
, tail2
, sym
;
248 /* Go through each element of PLIST. */
249 for (tail1
= plist
; ! NILP (tail1
); tail1
= Fcdr (Fcdr (tail1
)))
253 /* Go through i's plist, looking for tail1 */
254 for (tail2
= i
->plist
; ! NILP (tail2
); tail2
= Fcdr (Fcdr (tail2
)))
255 if (EQ (sym
, Fcar (tail2
)))
262 /* Changing the plists of individual intervals. */
264 /* Return the value of PROP in property-list PLIST, or Qunbound if it
267 property_value (plist
, prop
)
268 Lisp_Object plist
, prop
;
272 while (PLIST_ELT_P (plist
, value
))
273 if (EQ (XCONS (plist
)->car
, prop
))
274 return XCONS (value
)->car
;
276 plist
= XCONS (value
)->cdr
;
281 /* Set the properties of INTERVAL to PROPERTIES,
282 and record undo info for the previous values.
283 OBJECT is the string or buffer that INTERVAL belongs to. */
286 set_properties (properties
, interval
, object
)
287 Lisp_Object properties
, object
;
290 Lisp_Object sym
, value
;
292 if (BUFFERP (object
))
294 /* For each property in the old plist which is missing from PROPERTIES,
295 or has a different value in PROPERTIES, make an undo record. */
296 for (sym
= interval
->plist
;
297 PLIST_ELT_P (sym
, value
);
298 sym
= XCONS (value
)->cdr
)
299 if (! EQ (property_value (properties
, XCONS (sym
)->car
),
302 record_property_change (interval
->position
, LENGTH (interval
),
303 XCONS (sym
)->car
, XCONS (value
)->car
,
307 /* For each new property that has no value at all in the old plist,
308 make an undo record binding it to nil, so it will be removed. */
309 for (sym
= properties
;
310 PLIST_ELT_P (sym
, value
);
311 sym
= XCONS (value
)->cdr
)
312 if (EQ (property_value (interval
->plist
, XCONS (sym
)->car
), Qunbound
))
314 record_property_change (interval
->position
, LENGTH (interval
),
315 XCONS (sym
)->car
, Qnil
,
320 /* Store new properties. */
321 interval
->plist
= Fcopy_sequence (properties
);
324 /* Add the properties of PLIST to the interval I, or set
325 the value of I's property to the value of the property on PLIST
326 if they are different.
328 OBJECT should be the string or buffer the interval is in.
330 Return nonzero if this changes I (i.e., if any members of PLIST
331 are actually added to I's plist) */
334 add_properties (plist
, i
, object
)
339 Lisp_Object tail1
, tail2
, sym1
, val1
;
340 register int changed
= 0;
342 struct gcpro gcpro1
, gcpro2
, gcpro3
;
347 /* No need to protect OBJECT, because we can GC only in the case
348 where it is a buffer, and live buffers are always protected.
349 I and its plist are also protected, via OBJECT. */
350 GCPRO3 (tail1
, sym1
, val1
);
352 /* Go through each element of PLIST. */
353 for (tail1
= plist
; ! NILP (tail1
); tail1
= Fcdr (Fcdr (tail1
)))
356 val1
= Fcar (Fcdr (tail1
));
359 /* Go through I's plist, looking for sym1 */
360 for (tail2
= i
->plist
; ! NILP (tail2
); tail2
= Fcdr (Fcdr (tail2
)))
361 if (EQ (sym1
, Fcar (tail2
)))
363 /* No need to gcpro, because tail2 protects this
364 and it must be a cons cell (we get an error otherwise). */
365 register Lisp_Object this_cdr
;
367 this_cdr
= Fcdr (tail2
);
368 /* Found the property. Now check its value. */
371 /* The properties have the same value on both lists.
372 Continue to the next property. */
373 if (EQ (val1
, Fcar (this_cdr
)))
376 /* Record this change in the buffer, for undo purposes. */
377 if (BUFFERP (object
))
379 record_property_change (i
->position
, LENGTH (i
),
380 sym1
, Fcar (this_cdr
), object
);
383 /* I's property has a different value -- change it */
384 Fsetcar (this_cdr
, val1
);
391 /* Record this change in the buffer, for undo purposes. */
392 if (BUFFERP (object
))
394 record_property_change (i
->position
, LENGTH (i
),
397 i
->plist
= Fcons (sym1
, Fcons (val1
, i
->plist
));
407 /* For any members of PLIST which are properties of I, remove them
409 OBJECT is the string or buffer containing I. */
412 remove_properties (plist
, i
, object
)
417 register Lisp_Object tail1
, tail2
, sym
, current_plist
;
418 register int changed
= 0;
420 current_plist
= i
->plist
;
421 /* Go through each element of plist. */
422 for (tail1
= plist
; ! NILP (tail1
); tail1
= Fcdr (Fcdr (tail1
)))
426 /* First, remove the symbol if its at the head of the list */
427 while (! NILP (current_plist
) && EQ (sym
, Fcar (current_plist
)))
429 if (BUFFERP (object
))
431 record_property_change (i
->position
, LENGTH (i
),
432 sym
, Fcar (Fcdr (current_plist
)),
436 current_plist
= Fcdr (Fcdr (current_plist
));
440 /* Go through i's plist, looking for sym */
441 tail2
= current_plist
;
442 while (! NILP (tail2
))
444 register Lisp_Object
this;
445 this = Fcdr (Fcdr (tail2
));
446 if (EQ (sym
, Fcar (this)))
448 if (BUFFERP (object
))
450 record_property_change (i
->position
, LENGTH (i
),
451 sym
, Fcar (Fcdr (this)), object
);
454 Fsetcdr (Fcdr (tail2
), Fcdr (Fcdr (this)));
462 i
->plist
= current_plist
;
467 /* Remove all properties from interval I. Return non-zero
468 if this changes the interval. */
482 DEFUN ("text-properties-at", Ftext_properties_at
,
483 Stext_properties_at
, 1, 2, 0,
484 "Return the list of properties held by the character at POSITION\n\
485 in optional argument OBJECT, a string or buffer. If nil, OBJECT\n\
486 defaults to the current buffer.\n\
487 If POSITION is at the end of OBJECT, the value is nil.")
489 Lisp_Object position
, object
;
494 XSETBUFFER (object
, current_buffer
);
496 i
= validate_interval_range (object
, &position
, &position
, soft
);
497 if (NULL_INTERVAL_P (i
))
499 /* If POSITION is at the end of the interval,
500 it means it's the end of OBJECT.
501 There are no properties at the very end,
502 since no character follows. */
503 if (XINT (position
) == LENGTH (i
) + i
->position
)
509 DEFUN ("get-text-property", Fget_text_property
, Sget_text_property
, 2, 3, 0,
510 "Return the value of POSITION's property PROP, in OBJECT.\n\
511 OBJECT is optional and defaults to the current buffer.\n\
512 If POSITION is at the end of OBJECT, the value is nil.")
513 (position
, prop
, object
)
514 Lisp_Object position
, object
;
517 return textget (Ftext_properties_at (position
, object
), prop
);
520 DEFUN ("get-char-property", Fget_char_property
, Sget_char_property
, 2, 3, 0,
521 "Return the value of POSITION's property PROP, in OBJECT.\n\
522 OBJECT is optional and defaults to the current buffer.\n\
523 If POSITION is at the end of OBJECT, the value is nil.\n\
524 If OBJECT is a buffer, then overlay properties are considered as well as\n\
526 If OBJECT is a window, then that window's buffer is used, but window-specific\n\
527 overlays are considered only if they are associated with OBJECT.")
528 (position
, prop
, object
)
529 Lisp_Object position
, object
;
530 register Lisp_Object prop
;
532 struct window
*w
= 0;
534 CHECK_NUMBER_COERCE_MARKER (position
, 0);
537 XSETBUFFER (object
, current_buffer
);
539 if (WINDOWP (object
))
541 w
= XWINDOW (object
);
544 if (BUFFERP (object
))
546 int posn
= XINT (position
);
548 Lisp_Object
*overlay_vec
, tem
;
551 struct buffer
*obuf
= current_buffer
;
553 set_buffer_temp (XBUFFER (object
));
555 /* First try with room for 40 overlays. */
557 overlay_vec
= (Lisp_Object
*) alloca (len
* sizeof (Lisp_Object
));
559 noverlays
= overlays_at (posn
, 0, &overlay_vec
, &len
,
560 &next_overlay
, NULL
);
562 /* If there are more than 40,
563 make enough space for all, and try again. */
567 overlay_vec
= (Lisp_Object
*) alloca (len
* sizeof (Lisp_Object
));
568 noverlays
= overlays_at (posn
, 0, &overlay_vec
, &len
,
569 &next_overlay
, NULL
);
571 noverlays
= sort_overlays (overlay_vec
, noverlays
, w
);
573 set_buffer_temp (obuf
);
575 /* Now check the overlays in order of decreasing priority. */
576 while (--noverlays
>= 0)
578 tem
= Foverlay_get (overlay_vec
[noverlays
], prop
);
583 /* Not a buffer, or no appropriate overlay, so fall through to the
585 return (Fget_text_property (position
, prop
, object
));
588 DEFUN ("next-property-change", Fnext_property_change
,
589 Snext_property_change
, 1, 3, 0,
590 "Return the position of next property change.\n\
591 Scans characters forward from POSITION in OBJECT till it finds\n\
592 a change in some text property, then returns the position of the change.\n\
593 The optional second argument OBJECT is the string or buffer to scan.\n\
594 Return nil if the property is constant all the way to the end of OBJECT.\n\
595 If the value is non-nil, it is a position greater than POSITION, never equal.\n\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
, object
, limit
)
599 Lisp_Object position
, object
, limit
;
601 register INTERVAL i
, next
;
604 XSETBUFFER (object
, current_buffer
);
606 if (! NILP (limit
) && ! EQ (limit
, Qt
))
607 CHECK_NUMBER_COERCE_MARKER (limit
, 0);
609 i
= validate_interval_range (object
, &position
, &position
, soft
);
611 /* If LIMIT is t, return start of next interval--don't
612 bother checking further intervals. */
615 if (NULL_INTERVAL_P (i
))
618 next
= next_interval (i
);
620 if (NULL_INTERVAL_P (next
))
621 XSETFASTINT (position
, (STRINGP (object
)
622 ? XSTRING (object
)->size
623 : BUF_ZV (XBUFFER (object
))));
625 XSETFASTINT (position
, next
->position
- (STRINGP (object
)));
629 if (NULL_INTERVAL_P (i
))
632 next
= next_interval (i
);
634 while (! NULL_INTERVAL_P (next
) && intervals_equal (i
, next
)
635 && (NILP (limit
) || next
->position
< XFASTINT (limit
)))
636 next
= next_interval (next
);
638 if (NULL_INTERVAL_P (next
))
640 if (! NILP (limit
) && !(next
->position
< XFASTINT (limit
)))
643 XSETFASTINT (position
, next
->position
- (STRINGP (object
)));
647 /* Return 1 if there's a change in some property between BEG and END. */
650 property_change_between_p (beg
, end
)
653 register INTERVAL i
, next
;
654 Lisp_Object object
, pos
;
656 XSETBUFFER (object
, current_buffer
);
657 XSETFASTINT (pos
, beg
);
659 i
= validate_interval_range (object
, &pos
, &pos
, soft
);
660 if (NULL_INTERVAL_P (i
))
663 next
= next_interval (i
);
664 while (! NULL_INTERVAL_P (next
) && intervals_equal (i
, next
))
666 next
= next_interval (next
);
667 if (NULL_INTERVAL_P (next
))
669 if (next
->position
>= end
)
673 if (NULL_INTERVAL_P (next
))
679 DEFUN ("next-single-property-change", Fnext_single_property_change
,
680 Snext_single_property_change
, 2, 4, 0,
681 "Return the position of next property change for a specific property.\n\
682 Scans characters forward from POSITION till it finds\n\
683 a change in the PROP property, then returns the position of the change.\n\
684 The optional third argument OBJECT is the string or buffer to scan.\n\
685 The property values are compared with `eq'.\n\
686 Return nil if the property is constant all the way to the end of OBJECT.\n\
687 If the value is non-nil, it is a position greater than POSITION, never equal.\n\n\
688 If the optional fourth argument LIMIT is non-nil, don't search\n\
689 past position LIMIT; return LIMIT if nothing is found before LIMIT.")
690 (position
, prop
, object
, limit
)
691 Lisp_Object position
, prop
, object
, limit
;
693 register INTERVAL i
, next
;
694 register Lisp_Object here_val
;
697 XSETBUFFER (object
, current_buffer
);
700 CHECK_NUMBER_COERCE_MARKER (limit
, 0);
702 i
= validate_interval_range (object
, &position
, &position
, soft
);
703 if (NULL_INTERVAL_P (i
))
706 here_val
= textget (i
->plist
, prop
);
707 next
= next_interval (i
);
708 while (! NULL_INTERVAL_P (next
)
709 && EQ (here_val
, textget (next
->plist
, prop
))
710 && (NILP (limit
) || next
->position
< XFASTINT (limit
)))
711 next
= next_interval (next
);
713 if (NULL_INTERVAL_P (next
))
715 if (! NILP (limit
) && !(next
->position
< XFASTINT (limit
)))
718 XSETFASTINT (position
, next
->position
- (STRINGP (object
)));
722 DEFUN ("previous-property-change", Fprevious_property_change
,
723 Sprevious_property_change
, 1, 3, 0,
724 "Return the position of previous property change.\n\
725 Scans characters backwards from POSITION in OBJECT till it finds\n\
726 a change in some text property, then returns the position of the change.\n\
727 The optional second argument OBJECT is the string or buffer to scan.\n\
728 Return nil if the property is constant all the way to the start of OBJECT.\n\
729 If the value is non-nil, it is a position less than POSITION, never equal.\n\n\
730 If the optional third argument LIMIT is non-nil, don't search\n\
731 back past position LIMIT; return LIMIT if nothing is found until LIMIT.")
732 (position
, object
, limit
)
733 Lisp_Object position
, object
, limit
;
735 register INTERVAL i
, previous
;
738 XSETBUFFER (object
, current_buffer
);
741 CHECK_NUMBER_COERCE_MARKER (limit
, 0);
743 i
= validate_interval_range (object
, &position
, &position
, soft
);
744 if (NULL_INTERVAL_P (i
))
747 /* Start with the interval containing the char before point. */
748 if (i
->position
== XFASTINT (position
))
749 i
= previous_interval (i
);
751 previous
= previous_interval (i
);
752 while (! NULL_INTERVAL_P (previous
) && intervals_equal (previous
, i
)
754 || previous
->position
+ LENGTH (previous
) > XFASTINT (limit
)))
755 previous
= previous_interval (previous
);
756 if (NULL_INTERVAL_P (previous
))
759 && !(previous
->position
+ LENGTH (previous
) > XFASTINT (limit
)))
762 XSETFASTINT (position
, (previous
->position
+ LENGTH (previous
)
763 - (STRINGP (object
))));
767 DEFUN ("previous-single-property-change", Fprevious_single_property_change
,
768 Sprevious_single_property_change
, 2, 4, 0,
769 "Return the position of previous property change for a specific property.\n\
770 Scans characters backward from POSITION till it finds\n\
771 a change in the PROP property, then returns the position of the change.\n\
772 The optional third argument OBJECT is the string or buffer to scan.\n\
773 The property values are compared with `eq'.\n\
774 Return nil if the property is constant all the way to the start of OBJECT.\n\
775 If the value is non-nil, it is a position less than POSITION, never equal.\n\n\
776 If the optional fourth argument LIMIT is non-nil, don't search\n\
777 back past position LIMIT; return LIMIT if nothing is found until LIMIT.")
778 (position
, prop
, object
, limit
)
779 Lisp_Object position
, prop
, object
, limit
;
781 register INTERVAL i
, previous
;
782 register Lisp_Object here_val
;
785 XSETBUFFER (object
, current_buffer
);
788 CHECK_NUMBER_COERCE_MARKER (limit
, 0);
790 i
= validate_interval_range (object
, &position
, &position
, soft
);
792 /* Start with the interval containing the char before point. */
793 if (! NULL_INTERVAL_P (i
) && i
->position
== XFASTINT (position
))
794 i
= previous_interval (i
);
796 if (NULL_INTERVAL_P (i
))
799 here_val
= textget (i
->plist
, prop
);
800 previous
= previous_interval (i
);
801 while (! NULL_INTERVAL_P (previous
)
802 && EQ (here_val
, textget (previous
->plist
, prop
))
804 || previous
->position
+ LENGTH (previous
) > XFASTINT (limit
)))
805 previous
= previous_interval (previous
);
806 if (NULL_INTERVAL_P (previous
))
809 && !(previous
->position
+ LENGTH (previous
) > XFASTINT (limit
)))
812 XSETFASTINT (position
, (previous
->position
+ LENGTH (previous
)
813 - (STRINGP (object
))));
817 /* Callers note, this can GC when OBJECT is a buffer (or nil). */
819 DEFUN ("add-text-properties", Fadd_text_properties
,
820 Sadd_text_properties
, 3, 4, 0,
821 "Add properties to the text from START to END.\n\
822 The third argument PROPERTIES is a property list\n\
823 specifying the property values to add.\n\
824 The optional fourth argument, OBJECT,\n\
825 is the string or buffer containing the text.\n\
826 Return t if any property value actually changed, nil otherwise.")
827 (start
, end
, properties
, object
)
828 Lisp_Object start
, end
, properties
, object
;
830 register INTERVAL i
, unchanged
;
831 register int s
, len
, modified
= 0;
834 properties
= validate_plist (properties
);
835 if (NILP (properties
))
839 XSETBUFFER (object
, current_buffer
);
841 i
= validate_interval_range (object
, &start
, &end
, hard
);
842 if (NULL_INTERVAL_P (i
))
846 len
= XINT (end
) - s
;
848 /* No need to protect OBJECT, because we GC only if it's a buffer,
849 and live buffers are always protected. */
852 /* If we're not starting on an interval boundary, we have to
853 split this interval. */
854 if (i
->position
!= s
)
856 /* If this interval already has the properties, we can
858 if (interval_has_all_properties (properties
, i
))
860 int got
= (LENGTH (i
) - (s
- i
->position
));
862 RETURN_UNGCPRO (Qnil
);
864 i
= next_interval (i
);
869 i
= split_interval_right (unchanged
, s
- unchanged
->position
);
870 copy_properties (unchanged
, i
);
874 modify_region (XBUFFER (object
), XINT (start
), XINT (end
));
876 /* We are at the beginning of interval I, with LEN chars to scan. */
882 if (LENGTH (i
) >= len
)
884 /* We can UNGCPRO safely here, because there will be just
885 one more chance to gc, in the next call to add_properties,
886 and after that we will not need PROPERTIES or OBJECT again. */
889 if (interval_has_all_properties (properties
, i
))
891 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
892 XINT (end
) - XINT (start
));
894 return modified
? Qt
: Qnil
;
897 if (LENGTH (i
) == len
)
899 add_properties (properties
, i
, object
);
900 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
901 XINT (end
) - XINT (start
));
905 /* i doesn't have the properties, and goes past the change limit */
907 i
= split_interval_left (unchanged
, len
);
908 copy_properties (unchanged
, i
);
909 add_properties (properties
, i
, object
);
910 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
911 XINT (end
) - XINT (start
));
916 modified
+= add_properties (properties
, i
, object
);
917 i
= next_interval (i
);
921 /* Callers note, this can GC when OBJECT is a buffer (or nil). */
923 DEFUN ("put-text-property", Fput_text_property
,
924 Sput_text_property
, 4, 5, 0,
925 "Set one property of the text from START to END.\n\
926 The third and fourth arguments PROPERTY and VALUE\n\
927 specify the property to add.\n\
928 The optional fifth argument, OBJECT,\n\
929 is the string or buffer containing the text.")
930 (start
, end
, property
, value
, object
)
931 Lisp_Object start
, end
, property
, value
, object
;
933 Fadd_text_properties (start
, end
,
934 Fcons (property
, Fcons (value
, Qnil
)),
939 DEFUN ("set-text-properties", Fset_text_properties
,
940 Sset_text_properties
, 3, 4, 0,
941 "Completely replace properties of text from START to END.\n\
942 The third argument PROPERTIES is the new property list.\n\
943 The optional fourth argument, OBJECT,\n\
944 is the string or buffer containing the text.")
945 (start
, end
, properties
, object
)
946 Lisp_Object start
, end
, properties
, object
;
948 register INTERVAL i
, unchanged
;
949 register INTERVAL prev_changed
= NULL_INTERVAL
;
951 Lisp_Object ostart
, oend
;
952 int have_modified
= 0;
957 properties
= validate_plist (properties
);
960 XSETBUFFER (object
, current_buffer
);
962 /* If we want no properties for a whole string,
963 get rid of its intervals. */
964 if (NILP (properties
) && STRINGP (object
)
965 && XFASTINT (start
) == 0
966 && XFASTINT (end
) == XSTRING (object
)->size
)
968 if (! XSTRING (object
)->intervals
)
971 modify_region (XBUFFER (object
), XINT (start
), XINT (end
));
972 XSTRING (object
)->intervals
= 0;
973 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
974 XINT (end
) - XINT (start
));
978 i
= validate_interval_range (object
, &start
, &end
, soft
);
980 if (NULL_INTERVAL_P (i
))
982 /* If buffer has no properties, and we want none, return now. */
983 if (NILP (properties
))
986 /* Restore the original START and END values
987 because validate_interval_range increments them for strings. */
991 i
= validate_interval_range (object
, &start
, &end
, hard
);
992 /* This can return if start == end. */
993 if (NULL_INTERVAL_P (i
))
998 len
= XINT (end
) - s
;
1000 modify_region (XBUFFER (object
), XINT (start
), XINT (end
));
1002 if (i
->position
!= s
)
1005 i
= split_interval_right (unchanged
, s
- unchanged
->position
);
1007 if (LENGTH (i
) > len
)
1009 copy_properties (unchanged
, i
);
1010 i
= split_interval_left (i
, len
);
1011 set_properties (properties
, i
, object
);
1012 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
1013 XINT (end
) - XINT (start
));
1018 set_properties (properties
, i
, object
);
1020 if (LENGTH (i
) == len
)
1022 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
1023 XINT (end
) - XINT (start
));
1030 i
= next_interval (i
);
1033 /* We are starting at the beginning of an interval, I */
1039 if (LENGTH (i
) >= len
)
1041 if (LENGTH (i
) > len
)
1042 i
= split_interval_left (i
, len
);
1044 /* We have to call set_properties even if we are going to
1045 merge the intervals, so as to make the undo records
1046 and cause redisplay to happen. */
1047 set_properties (properties
, i
, object
);
1048 if (!NULL_INTERVAL_P (prev_changed
))
1049 merge_interval_left (i
);
1050 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
1051 XINT (end
) - XINT (start
));
1057 /* We have to call set_properties even if we are going to
1058 merge the intervals, so as to make the undo records
1059 and cause redisplay to happen. */
1060 set_properties (properties
, i
, object
);
1061 if (NULL_INTERVAL_P (prev_changed
))
1064 prev_changed
= i
= merge_interval_left (i
);
1066 i
= next_interval (i
);
1069 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
1070 XINT (end
) - XINT (start
));
1074 DEFUN ("remove-text-properties", Fremove_text_properties
,
1075 Sremove_text_properties
, 3, 4, 0,
1076 "Remove some properties from text from START to END.\n\
1077 The third argument PROPERTIES is a property list\n\
1078 whose property names specify the properties to remove.\n\
1079 \(The values stored in PROPERTIES are ignored.)\n\
1080 The optional fourth argument, OBJECT,\n\
1081 is the string or buffer containing the text.\n\
1082 Return t if any property was actually removed, nil otherwise.")
1083 (start
, end
, properties
, object
)
1084 Lisp_Object start
, end
, properties
, object
;
1086 register INTERVAL i
, unchanged
;
1087 register int s
, len
, modified
= 0;
1090 XSETBUFFER (object
, current_buffer
);
1092 i
= validate_interval_range (object
, &start
, &end
, soft
);
1093 if (NULL_INTERVAL_P (i
))
1097 len
= XINT (end
) - s
;
1099 if (i
->position
!= s
)
1101 /* No properties on this first interval -- return if
1102 it covers the entire region. */
1103 if (! interval_has_some_properties (properties
, i
))
1105 int got
= (LENGTH (i
) - (s
- i
->position
));
1109 i
= next_interval (i
);
1111 /* Split away the beginning of this interval; what we don't
1116 i
= split_interval_right (unchanged
, s
- unchanged
->position
);
1117 copy_properties (unchanged
, i
);
1121 modify_region (XBUFFER (object
), XINT (start
), XINT (end
));
1123 /* We are at the beginning of an interval, with len to scan */
1129 if (LENGTH (i
) >= len
)
1131 if (! interval_has_some_properties (properties
, i
))
1132 return modified
? Qt
: Qnil
;
1134 if (LENGTH (i
) == len
)
1136 remove_properties (properties
, i
, object
);
1137 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
1138 XINT (end
) - XINT (start
));
1142 /* i has the properties, and goes past the change limit */
1144 i
= split_interval_left (i
, len
);
1145 copy_properties (unchanged
, i
);
1146 remove_properties (properties
, i
, object
);
1147 signal_after_change (XINT (start
), XINT (end
) - XINT (start
),
1148 XINT (end
) - XINT (start
));
1153 modified
+= remove_properties (properties
, i
, object
);
1154 i
= next_interval (i
);
1158 DEFUN ("text-property-any", Ftext_property_any
,
1159 Stext_property_any
, 4, 5, 0,
1160 "Check text from START to END for property PROPERTY equalling VALUE.\n\
1161 If so, return the position of the first character whose property PROPERTY\n\
1162 is `eq' to VALUE. Otherwise return nil.\n\
1163 The optional fifth argument, OBJECT, is the string or buffer\n\
1164 containing the text.")
1165 (start
, end
, property
, value
, object
)
1166 Lisp_Object start
, end
, property
, value
, object
;
1168 register INTERVAL i
;
1169 register int e
, pos
;
1172 XSETBUFFER (object
, current_buffer
);
1173 i
= validate_interval_range (object
, &start
, &end
, soft
);
1174 if (NULL_INTERVAL_P (i
))
1175 return (!NILP (value
) || EQ (start
, end
) ? Qnil
: start
);
1178 while (! NULL_INTERVAL_P (i
))
1180 if (i
->position
>= e
)
1182 if (EQ (textget (i
->plist
, property
), value
))
1185 if (pos
< XINT (start
))
1187 return make_number (pos
- (STRINGP (object
)));
1189 i
= next_interval (i
);
1194 DEFUN ("text-property-not-all", Ftext_property_not_all
,
1195 Stext_property_not_all
, 4, 5, 0,
1196 "Check text from START to END for property PROPERTY not equalling VALUE.\n\
1197 If so, return the position of the first character whose property PROPERTY\n\
1198 is not `eq' to VALUE. Otherwise, return nil.\n\
1199 The optional fifth argument, OBJECT, is the string or buffer\n\
1200 containing the text.")
1201 (start
, end
, property
, value
, object
)
1202 Lisp_Object start
, end
, property
, value
, object
;
1204 register INTERVAL i
;
1208 XSETBUFFER (object
, current_buffer
);
1209 i
= validate_interval_range (object
, &start
, &end
, soft
);
1210 if (NULL_INTERVAL_P (i
))
1211 return (NILP (value
) || EQ (start
, end
)) ? Qnil
: start
;
1215 while (! NULL_INTERVAL_P (i
))
1217 if (i
->position
>= e
)
1219 if (! EQ (textget (i
->plist
, property
), value
))
1221 if (i
->position
> s
)
1223 return make_number (s
- (STRINGP (object
)));
1225 i
= next_interval (i
);
1230 #if 0 /* You can use set-text-properties for this. */
1232 DEFUN ("erase-text-properties", Ferase_text_properties
,
1233 Serase_text_properties
, 2, 3, 0,
1234 "Remove all properties from the text from START to END.\n\
1235 The optional third argument, OBJECT,\n\
1236 is the string or buffer containing the text.")
1237 (start
, end
, object
)
1238 Lisp_Object start
, end
, object
;
1240 register INTERVAL i
;
1241 register INTERVAL prev_changed
= NULL_INTERVAL
;
1242 register int s
, len
, modified
;
1245 XSETBUFFER (object
, current_buffer
);
1247 i
= validate_interval_range (object
, &start
, &end
, soft
);
1248 if (NULL_INTERVAL_P (i
))
1252 len
= XINT (end
) - s
;
1254 if (i
->position
!= s
)
1257 register INTERVAL unchanged
= i
;
1259 /* If there are properties here, then this text will be modified. */
1260 if (! NILP (i
->plist
))
1262 i
= split_interval_right (unchanged
, s
- unchanged
->position
);
1266 if (LENGTH (i
) > len
)
1268 i
= split_interval_right (i
, len
);
1269 copy_properties (unchanged
, i
);
1273 if (LENGTH (i
) == len
)
1278 /* If the text of I is without any properties, and contains
1279 LEN or more characters, then we may return without changing
1281 else if (LENGTH (i
) - (s
- i
->position
) <= len
)
1283 /* The amount of text to change extends past I, so just note
1284 how much we've gotten. */
1286 got
= LENGTH (i
) - (s
- i
->position
);
1290 i
= next_interval (i
);
1293 /* We are starting at the beginning of an interval, I. */
1296 if (LENGTH (i
) >= len
)
1298 /* If I has no properties, simply merge it if possible. */
1299 if (NILP (i
->plist
))
1301 if (! NULL_INTERVAL_P (prev_changed
))
1302 merge_interval_left (i
);
1304 return modified
? Qt
: Qnil
;
1307 if (LENGTH (i
) > len
)
1308 i
= split_interval_left (i
, len
);
1309 if (! NULL_INTERVAL_P (prev_changed
))
1310 merge_interval_left (i
);
1317 /* Here if we still need to erase past the end of I */
1319 if (NULL_INTERVAL_P (prev_changed
))
1321 modified
+= erase_properties (i
);
1326 modified
+= ! NILP (i
->plist
);
1327 /* Merging I will give it the properties of PREV_CHANGED. */
1328 prev_changed
= i
= merge_interval_left (i
);
1331 i
= next_interval (i
);
1334 return modified
? Qt
: Qnil
;
1338 /* I don't think this is the right interface to export; how often do you
1339 want to do something like this, other than when you're copying objects
1342 I think it would be better to have a pair of functions, one which
1343 returns the text properties of a region as a list of ranges and
1344 plists, and another which applies such a list to another object. */
1346 /* Add properties from SRC to SRC of SRC, starting at POS in DEST.
1347 SRC and DEST may each refer to strings or buffers.
1348 Optional sixth argument PROP causes only that property to be copied.
1349 Properties are copied to DEST as if by `add-text-properties'.
1350 Return t if any property value actually changed, nil otherwise. */
1352 /* Note this can GC when DEST is a buffer. */
1355 copy_text_properties (start
, end
, src
, pos
, dest
, prop
)
1356 Lisp_Object start
, end
, src
, pos
, dest
, prop
;
1362 int s
, e
, e2
, p
, len
, modified
= 0;
1363 struct gcpro gcpro1
, gcpro2
;
1365 i
= validate_interval_range (src
, &start
, &end
, soft
);
1366 if (NULL_INTERVAL_P (i
))
1369 CHECK_NUMBER_COERCE_MARKER (pos
, 0);
1371 Lisp_Object dest_start
, dest_end
;
1374 XSETFASTINT (dest_end
, XINT (dest_start
) + (XINT (end
) - XINT (start
)));
1375 /* Apply this to a copy of pos; it will try to increment its arguments,
1376 which we don't want. */
1377 validate_interval_range (dest
, &dest_start
, &dest_end
, soft
);
1388 e2
= i
->position
+ LENGTH (i
);
1395 while (! NILP (plist
))
1397 if (EQ (Fcar (plist
), prop
))
1399 plist
= Fcons (prop
, Fcons (Fcar (Fcdr (plist
)), Qnil
));
1402 plist
= Fcdr (Fcdr (plist
));
1406 /* Must defer modifications to the interval tree in case src
1407 and dest refer to the same string or buffer. */
1408 stuff
= Fcons (Fcons (make_number (p
),
1409 Fcons (make_number (p
+ len
),
1410 Fcons (plist
, Qnil
))),
1414 i
= next_interval (i
);
1415 if (NULL_INTERVAL_P (i
))
1422 GCPRO2 (stuff
, dest
);
1424 while (! NILP (stuff
))
1427 res
= Fadd_text_properties (Fcar (res
), Fcar (Fcdr (res
)),
1428 Fcar (Fcdr (Fcdr (res
))), dest
);
1431 stuff
= Fcdr (stuff
);
1436 return modified
? Qt
: Qnil
;
1439 /* Call the modification hook functions in LIST, each with START and END. */
1442 call_mod_hooks (list
, start
, end
)
1443 Lisp_Object list
, start
, end
;
1445 struct gcpro gcpro1
;
1447 while (!NILP (list
))
1449 call2 (Fcar (list
), start
, end
);
1455 /* Check for read-only intervals and signal an error if we find one.
1456 Then check for any modification hooks in the range START up to
1457 (but not including) END. Create a list of all these hooks in
1458 lexicographic order, eliminating consecutive extra copies of the
1459 same hook. Then call those hooks in order, with START and END - 1
1463 verify_interval_modification (buf
, start
, end
)
1467 register INTERVAL intervals
= BUF_INTERVALS (buf
);
1468 register INTERVAL i
, prev
;
1470 register Lisp_Object prev_mod_hooks
;
1471 Lisp_Object mod_hooks
;
1472 struct gcpro gcpro1
;
1475 prev_mod_hooks
= Qnil
;
1478 interval_insert_behind_hooks
= Qnil
;
1479 interval_insert_in_front_hooks
= Qnil
;
1481 if (NULL_INTERVAL_P (intervals
))
1491 /* For an insert operation, check the two chars around the position. */
1495 Lisp_Object before
, after
;
1497 /* Set I to the interval containing the char after START,
1498 and PREV to the interval containing the char before START.
1499 Either one may be null. They may be equal. */
1500 i
= find_interval (intervals
, start
);
1502 if (start
== BUF_BEGV (buf
))
1504 else if (i
->position
== start
)
1505 prev
= previous_interval (i
);
1506 else if (i
->position
< start
)
1508 if (start
== BUF_ZV (buf
))
1511 /* If Vinhibit_read_only is set and is not a list, we can
1512 skip the read_only checks. */
1513 if (NILP (Vinhibit_read_only
) || CONSP (Vinhibit_read_only
))
1515 /* If I and PREV differ we need to check for the read-only
1516 property together with its stickiness. If either I or
1517 PREV are 0, this check is all we need.
1518 We have to take special care, since read-only may be
1519 indirectly defined via the category property. */
1522 if (! NULL_INTERVAL_P (i
))
1524 after
= textget (i
->plist
, Qread_only
);
1526 /* If interval I is read-only and read-only is
1527 front-sticky, inhibit insertion.
1528 Check for read-only as well as category. */
1530 && NILP (Fmemq (after
, Vinhibit_read_only
)))
1534 tem
= textget (i
->plist
, Qfront_sticky
);
1535 if (TMEM (Qread_only
, tem
)
1536 || (NILP (Fplist_get (i
->plist
, Qread_only
))
1537 && TMEM (Qcategory
, tem
)))
1538 error ("Attempt to insert within read-only text");
1542 if (! NULL_INTERVAL_P (prev
))
1544 before
= textget (prev
->plist
, Qread_only
);
1546 /* If interval PREV is read-only and read-only isn't
1547 rear-nonsticky, inhibit insertion.
1548 Check for read-only as well as category. */
1550 && NILP (Fmemq (before
, Vinhibit_read_only
)))
1554 tem
= textget (prev
->plist
, Qrear_nonsticky
);
1555 if (! TMEM (Qread_only
, tem
)
1556 && (! NILP (Fplist_get (prev
->plist
,Qread_only
))
1557 || ! TMEM (Qcategory
, tem
)))
1558 error ("Attempt to insert within read-only text");
1562 else if (! NULL_INTERVAL_P (i
))
1564 after
= textget (i
->plist
, Qread_only
);
1566 /* If interval I is read-only and read-only is
1567 front-sticky, inhibit insertion.
1568 Check for read-only as well as category. */
1569 if (! NILP (after
) && NILP (Fmemq (after
, Vinhibit_read_only
)))
1573 tem
= textget (i
->plist
, Qfront_sticky
);
1574 if (TMEM (Qread_only
, tem
)
1575 || (NILP (Fplist_get (i
->plist
, Qread_only
))
1576 && TMEM (Qcategory
, tem
)))
1577 error ("Attempt to insert within read-only text");
1579 tem
= textget (prev
->plist
, Qrear_nonsticky
);
1580 if (! TMEM (Qread_only
, tem
)
1581 && (! NILP (Fplist_get (prev
->plist
, Qread_only
))
1582 || ! TMEM (Qcategory
, tem
)))
1583 error ("Attempt to insert within read-only text");
1588 /* Run both insert hooks (just once if they're the same). */
1589 if (!NULL_INTERVAL_P (prev
))
1590 interval_insert_behind_hooks
1591 = textget (prev
->plist
, Qinsert_behind_hooks
);
1592 if (!NULL_INTERVAL_P (i
))
1593 interval_insert_in_front_hooks
1594 = textget (i
->plist
, Qinsert_in_front_hooks
);
1598 /* Loop over intervals on or next to START...END,
1599 collecting their hooks. */
1601 i
= find_interval (intervals
, start
);
1604 if (! INTERVAL_WRITABLE_P (i
))
1605 error ("Attempt to modify read-only text");
1607 mod_hooks
= textget (i
->plist
, Qmodification_hooks
);
1608 if (! NILP (mod_hooks
) && ! EQ (mod_hooks
, prev_mod_hooks
))
1610 hooks
= Fcons (mod_hooks
, hooks
);
1611 prev_mod_hooks
= mod_hooks
;
1614 i
= next_interval (i
);
1616 /* Keep going thru the interval containing the char before END. */
1617 while (! NULL_INTERVAL_P (i
) && i
->position
< end
);
1620 hooks
= Fnreverse (hooks
);
1621 while (! EQ (hooks
, Qnil
))
1623 call_mod_hooks (Fcar (hooks
), make_number (start
),
1625 hooks
= Fcdr (hooks
);
1631 /* Run the interval hooks for an insertion.
1632 verify_interval_modification chose which hooks to run;
1633 this function is called after the insertion happens
1634 so it can indicate the range of inserted text. */
1637 report_interval_modification (start
, end
)
1638 Lisp_Object start
, end
;
1640 if (! NILP (interval_insert_behind_hooks
))
1641 call_mod_hooks (interval_insert_behind_hooks
,
1642 make_number (start
), make_number (end
));
1643 if (! NILP (interval_insert_in_front_hooks
)
1644 && ! EQ (interval_insert_in_front_hooks
,
1645 interval_insert_behind_hooks
))
1646 call_mod_hooks (interval_insert_in_front_hooks
,
1647 make_number (start
), make_number (end
));
1653 DEFVAR_LISP ("default-text-properties", &Vdefault_text_properties
,
1654 "Property-list used as default values.\n\
1655 The value of a property in this list is seen as the value for every\n\
1656 character that does not have its own value for that property.");
1657 Vdefault_text_properties
= Qnil
;
1659 DEFVAR_LISP ("inhibit-point-motion-hooks", &Vinhibit_point_motion_hooks
,
1660 "If non-nil, don't run `point-left' and `point-entered' text properties.\n\
1661 This also inhibits the use of the `intangible' text property.");
1662 Vinhibit_point_motion_hooks
= Qnil
;
1664 staticpro (&interval_insert_behind_hooks
);
1665 staticpro (&interval_insert_in_front_hooks
);
1666 interval_insert_behind_hooks
= Qnil
;
1667 interval_insert_in_front_hooks
= Qnil
;
1670 /* Common attributes one might give text */
1672 staticpro (&Qforeground
);
1673 Qforeground
= intern ("foreground");
1674 staticpro (&Qbackground
);
1675 Qbackground
= intern ("background");
1677 Qfont
= intern ("font");
1678 staticpro (&Qstipple
);
1679 Qstipple
= intern ("stipple");
1680 staticpro (&Qunderline
);
1681 Qunderline
= intern ("underline");
1682 staticpro (&Qread_only
);
1683 Qread_only
= intern ("read-only");
1684 staticpro (&Qinvisible
);
1685 Qinvisible
= intern ("invisible");
1686 staticpro (&Qintangible
);
1687 Qintangible
= intern ("intangible");
1688 staticpro (&Qcategory
);
1689 Qcategory
= intern ("category");
1690 staticpro (&Qlocal_map
);
1691 Qlocal_map
= intern ("local-map");
1692 staticpro (&Qfront_sticky
);
1693 Qfront_sticky
= intern ("front-sticky");
1694 staticpro (&Qrear_nonsticky
);
1695 Qrear_nonsticky
= intern ("rear-nonsticky");
1697 /* Properties that text might use to specify certain actions */
1699 staticpro (&Qmouse_left
);
1700 Qmouse_left
= intern ("mouse-left");
1701 staticpro (&Qmouse_entered
);
1702 Qmouse_entered
= intern ("mouse-entered");
1703 staticpro (&Qpoint_left
);
1704 Qpoint_left
= intern ("point-left");
1705 staticpro (&Qpoint_entered
);
1706 Qpoint_entered
= intern ("point-entered");
1708 defsubr (&Stext_properties_at
);
1709 defsubr (&Sget_text_property
);
1710 defsubr (&Sget_char_property
);
1711 defsubr (&Snext_property_change
);
1712 defsubr (&Snext_single_property_change
);
1713 defsubr (&Sprevious_property_change
);
1714 defsubr (&Sprevious_single_property_change
);
1715 defsubr (&Sadd_text_properties
);
1716 defsubr (&Sput_text_property
);
1717 defsubr (&Sset_text_properties
);
1718 defsubr (&Sremove_text_properties
);
1719 defsubr (&Stext_property_any
);
1720 defsubr (&Stext_property_not_all
);
1721 /* defsubr (&Serase_text_properties); */
1722 /* defsubr (&Scopy_text_properties); */
1727 lose
-- this shouldn
't be compiled if USE_TEXT_PROPERTIES isn't defined
1729 #endif /* USE_TEXT_PROPERTIES */