annotate src/textprop.c @ 3960:7be89f84a882

* textprop.c (set_properties): Add undo records to remove entirely new properties. Only record old property values for those properties whose values have changed. * textprop.c (set_properties): Don't try to make undo records if OBJECT is a string.
author Jim Blandy <jimb@redhat.com>
date Fri, 02 Jul 1993 22:50:40 +0000
parents e07d474bdba9
children b9bdcf862c67
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1 /* Interface code for dealing with text properties.
2053
8bdcc55ebd8f (Qmodification_hooks): Renamed from Qmodification.
Richard M. Stallman <rms@gnu.org>
parents: 1965
diff changeset
2 Copyright (C) 1993 Free Software Foundation, Inc.
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
3
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
4 This file is part of GNU Emacs.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
5
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
3698
e748df7e6e74 Refer to GPL version two.
Jim Blandy <jimb@redhat.com>
parents: 3641
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
9 any later version.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14 GNU General Public License for more details.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20 #include "config.h"
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21 #include "lisp.h"
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
22 #include "intervals.h"
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
23 #include "buffer.h"
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
24
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
25
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
26 /* NOTES: previous- and next- property change will have to skip
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
27 zero-length intervals if they are implemented. This could be done
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
28 inside next_interval and previous_interval.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
29
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
30 set_properties needs to deal with the interval property cache.
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
31
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
32 It is assumed that for any interval plist, a property appears
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
33 only once on the list. Although some code i.e., remove_properties,
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
34 handles the more general case, the uniqueness of properties is
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3553
diff changeset
35 necessary for the system to remain consistent. This requirement
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
36 is enforced by the subrs installing properties onto the intervals. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
37
1302
538cc0cd6d83 * textprop.c: Conditionalize all functions on
Joseph Arceneaux <jla@gnu.org>
parents: 1283
diff changeset
38 /* The rest of the file is within this conditional */
538cc0cd6d83 * textprop.c: Conditionalize all functions on
Joseph Arceneaux <jla@gnu.org>
parents: 1283
diff changeset
39 #ifdef USE_TEXT_PROPERTIES
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
40
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
41 /* Types of hooks. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42 Lisp_Object Qmouse_left;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
43 Lisp_Object Qmouse_entered;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
44 Lisp_Object Qpoint_left;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
45 Lisp_Object Qpoint_entered;
2053
8bdcc55ebd8f (Qmodification_hooks): Renamed from Qmodification.
Richard M. Stallman <rms@gnu.org>
parents: 1965
diff changeset
46 Lisp_Object Qmodification_hooks;
2058
a43d0bb1b7d8 (Fget_text_property): Use textget.
Richard M. Stallman <rms@gnu.org>
parents: 2053
diff changeset
47 Lisp_Object Qcategory;
a43d0bb1b7d8 (Fget_text_property): Use textget.
Richard M. Stallman <rms@gnu.org>
parents: 2053
diff changeset
48 Lisp_Object Qlocal_map;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
50 /* Visual properties text (including strings) may have. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
51 Lisp_Object Qforeground, Qbackground, Qfont, Qunderline, Qstipple;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
52 Lisp_Object Qinvisible, Qread_only;
3960
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
53
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
54 /* If o1 is a cons whose cdr is a cons, return non-zero and set o2 to
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
55 the o1's cdr. Otherwise, return zero. This is handy for
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
56 traversing plists. */
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
57 #define PLIST_ELT_P(o1, o2) (CONSP (o1) && CONSP ((o2) = XCONS (o1)->cdr))
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
58
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
59
1055
7eb43ab890e0 entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents: 1029
diff changeset
60 /* Extract the interval at the position pointed to by BEGIN from
7eb43ab890e0 entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents: 1029
diff changeset
61 OBJECT, a string or buffer. Additionally, check that the positions
7eb43ab890e0 entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents: 1029
diff changeset
62 pointed to by BEGIN and END are within the bounds of OBJECT, and
7eb43ab890e0 entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents: 1029
diff changeset
63 reverse them if *BEGIN is greater than *END. The objects pointed
7eb43ab890e0 entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents: 1029
diff changeset
64 to by BEGIN and END may be integers or markers; if the latter, they
7eb43ab890e0 entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents: 1029
diff changeset
65 are coerced to integers.
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
66
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
67 When OBJECT is a string, we increment *BEGIN and *END
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
68 to make them origin-one.
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
69
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
70 Note that buffer points don't correspond to interval indices.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
71 For example, point-max is 1 greater than the index of the last
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
72 character. This difference is handled in the caller, which uses
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
73 the validated points to determine a length, and operates on that.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
74 Exceptions are Ftext_properties_at, Fnext_property_change, and
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
75 Fprevious_property_change which call this function with BEGIN == END.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
76 Handle this case specially.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
77
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
78 If FORCE is soft (0), it's OK to return NULL_INTERVAL. Otherwise,
1055
7eb43ab890e0 entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents: 1029
diff changeset
79 create an interval tree for OBJECT if one doesn't exist, provided
7eb43ab890e0 entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents: 1029
diff changeset
80 the object actually contains text. In the current design, if there
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
81 is no text, there can be no text properties. */
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
82
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
83 #define soft 0
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
84 #define hard 1
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
85
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
86 static INTERVAL
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
87 validate_interval_range (object, begin, end, force)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
88 Lisp_Object object, *begin, *end;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
89 int force;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
90 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
91 register INTERVAL i;
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
92 int searchpos;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
93
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
94 CHECK_STRING_OR_BUFFER (object, 0);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
95 CHECK_NUMBER_COERCE_MARKER (*begin, 0);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
96 CHECK_NUMBER_COERCE_MARKER (*end, 0);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
97
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
98 /* If we are asked for a point, but from a subr which operates
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
99 on a range, then return nothing. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
100 if (*begin == *end && begin != end)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
101 return NULL_INTERVAL;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
102
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
103 if (XINT (*begin) > XINT (*end))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
104 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
105 Lisp_Object n;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
106 n = *begin;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
107 *begin = *end;
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
108 *end = n;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
109 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
110
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
111 if (XTYPE (object) == Lisp_Buffer)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
112 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
113 register struct buffer *b = XBUFFER (object);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
114
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
115 if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
116 && XINT (*end) <= BUF_ZV (b)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
117 args_out_of_range (*begin, *end);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
118 i = b->intervals;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
119
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
120 /* If there's no text, there are no properties. */
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
121 if (BUF_BEGV (b) == BUF_ZV (b))
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
122 return NULL_INTERVAL;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
123
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
124 searchpos = XINT (*begin);
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
125 if (searchpos == BUF_Z (b))
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
126 searchpos--;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
127 #if 0
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
128 /* Special case for point-max: return the interval for the
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
129 last character. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
130 if (*begin == *end && *begin == BUF_Z (b))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
131 *begin -= 1;
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
132 #endif
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
133 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
134 else
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
135 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
136 register struct Lisp_String *s = XSTRING (object);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
137
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
138 if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end)
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
139 && XINT (*end) <= s->size))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
140 args_out_of_range (*begin, *end);
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
141 /* User-level Positions in strings start with 0,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
142 but the interval code always wants positions starting with 1. */
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
143 XFASTINT (*begin) += 1;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
144 XFASTINT (*end) += 1;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
145 i = s->intervals;
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
146
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
147 if (s->size == 0)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
148 return NULL_INTERVAL;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
149
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
150 searchpos = XINT (*begin);
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
151 if (searchpos > s->size)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
152 searchpos--;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
153 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
154
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
155 if (NULL_INTERVAL_P (i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
156 return (force ? create_root_interval (object) : i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
157
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
158 return find_interval (i, searchpos);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
159 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
160
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
161 /* Validate LIST as a property list. If LIST is not a list, then
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
162 make one consisting of (LIST nil). Otherwise, verify that LIST
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
163 is even numbered and thus suitable as a plist. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
164
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
165 static Lisp_Object
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
166 validate_plist (list)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
167 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
168 if (NILP (list))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
169 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
170
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
171 if (CONSP (list))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
172 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
173 register int i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
174 register Lisp_Object tail;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
175 for (i = 0, tail = list; !NILP (tail); i++)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
176 tail = Fcdr (tail);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
177 if (i & 1)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
178 error ("Odd length text property list");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
179 return list;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
180 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
181
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
182 return Fcons (list, Fcons (Qnil, Qnil));
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
183 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
184
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
185 /* Return nonzero if interval I has all the properties,
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
186 with the same values, of list PLIST. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
187
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
188 static int
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
189 interval_has_all_properties (plist, i)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
190 Lisp_Object plist;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
191 INTERVAL i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
192 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
193 register Lisp_Object tail1, tail2, sym1, sym2;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
194 register int found;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
195
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
196 /* Go through each element of PLIST. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
197 for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
198 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
199 sym1 = Fcar (tail1);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
200 found = 0;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
201
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
202 /* Go through I's plist, looking for sym1 */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
203 for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
204 if (EQ (sym1, Fcar (tail2)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
205 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
206 /* Found the same property on both lists. If the
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
207 values are unequal, return zero. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
208 if (! EQ (Fequal (Fcar (Fcdr (tail1)), Fcar (Fcdr (tail2))),
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
209 Qt))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
210 return 0;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
211
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
212 /* Property has same value on both lists; go to next one. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
213 found = 1;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
214 break;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
215 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
216
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
217 if (! found)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
218 return 0;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
219 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
220
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
221 return 1;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
222 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
223
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
224 /* Return nonzero if the plist of interval I has any of the
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
225 properties of PLIST, regardless of their values. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
226
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
227 static INLINE int
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
228 interval_has_some_properties (plist, i)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
229 Lisp_Object plist;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
230 INTERVAL i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
231 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
232 register Lisp_Object tail1, tail2, sym;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
233
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
234 /* Go through each element of PLIST. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
235 for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
236 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
237 sym = Fcar (tail1);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
238
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
239 /* Go through i's plist, looking for tail1 */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
240 for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
241 if (EQ (sym, Fcar (tail2)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
242 return 1;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
243 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
244
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
245 return 0;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
246 }
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
247
3960
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
248 /* Changing the plists of individual intervals. */
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
249
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
250 /* Return the value of PROP in property-list PLIST, or Qunbound if it
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
251 has none. */
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
252 static int
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
253 property_value (plist, prop)
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
254 {
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
255 Lisp_Object value;
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
256
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
257 while (PLIST_ELT_P (plist, value))
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
258 if (EQ (XCONS (plist)->car, prop))
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
259 return XCONS (value)->car;
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
260 else
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
261 plist = XCONS (value)->cdr;
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
262
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
263 return Qunbound;
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
264 }
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
265
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
266 /* Set the properties of INTERVAL to PROPERTIES,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
267 and record undo info for the previous values.
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
268 OBJECT is the string or buffer that INTERVAL belongs to. */
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
269
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
270 static void
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
271 set_properties (properties, interval, object)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
272 Lisp_Object properties, object;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
273 INTERVAL interval;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
274 {
3960
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
275 Lisp_Object sym, value;
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
276
3960
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
277 if (BUFFERP (object))
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
278 {
3960
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
279 /* For each property in the old plist which is missing from PROPERTIES,
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
280 or has a different value in PROPERTIES, make an undo record. */
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
281 for (sym = interval->plist;
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
282 PLIST_ELT_P (sym, value);
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
283 sym = XCONS (value)->cdr)
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
284 if (! EQ (property_value (properties, XCONS (sym)->car),
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
285 XCONS (value)->car))
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
286 record_property_change (interval->position, LENGTH (interval),
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
287 XCONS (sym)->car, XCONS (value)->car,
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
288 object);
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
289
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
290 /* For each new property that has no value at all in the old plist,
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
291 make an undo record binding it to nil, so it will be removed. */
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
292 for (sym = properties;
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
293 PLIST_ELT_P (sym, value);
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
294 sym = XCONS (value)->cdr)
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
295 if (EQ (property_value (interval->plist, XCONS (sym)->car), Qunbound))
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
296 record_property_change (interval->position, LENGTH (interval),
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
297 XCONS (sym)->car, Qnil,
7be89f84a882 * textprop.c (set_properties): Add undo records to remove entirely
Jim Blandy <jimb@redhat.com>
parents: 3858
diff changeset
298 object);
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
299 }
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
300
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
301 /* Store new properties. */
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
302 interval->plist = Fcopy_sequence (properties);
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
303 }
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
304
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
305 /* Add the properties of PLIST to the interval I, or set
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
306 the value of I's property to the value of the property on PLIST
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
307 if they are different.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
308
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
309 OBJECT should be the string or buffer the interval is in.
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
310
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
311 Return nonzero if this changes I (i.e., if any members of PLIST
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
312 are actually added to I's plist) */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
313
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
314 static int
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
315 add_properties (plist, i, object)
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
316 Lisp_Object plist;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
317 INTERVAL i;
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
318 Lisp_Object object;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
319 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
320 register Lisp_Object tail1, tail2, sym1, val1;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
321 register int changed = 0;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
322 register int found;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
323
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
324 /* Go through each element of PLIST. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
325 for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
326 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
327 sym1 = Fcar (tail1);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
328 val1 = Fcar (Fcdr (tail1));
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
329 found = 0;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
330
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
331 /* Go through I's plist, looking for sym1 */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
332 for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
333 if (EQ (sym1, Fcar (tail2)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
334 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
335 register Lisp_Object this_cdr = Fcdr (tail2);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
336
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
337 /* Found the property. Now check its value. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
338 found = 1;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
339
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
340 /* The properties have the same value on both lists.
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
341 Continue to the next property. */
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
342 if (!NILP (Fequal (val1, Fcar (this_cdr))))
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
343 break;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
344
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
345 /* Record this change in the buffer, for undo purposes. */
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
346 if (XTYPE (object) == Lisp_Buffer)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
347 {
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
348 record_property_change (i->position, LENGTH (i),
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
349 sym1, Fcar (this_cdr), object);
2783
789c11177579 The text property routines can now modify buffers other
Jim Blandy <jimb@redhat.com>
parents: 2762
diff changeset
350 modify_region (XBUFFER (object),
789c11177579 The text property routines can now modify buffers other
Jim Blandy <jimb@redhat.com>
parents: 2762
diff changeset
351 make_number (i->position),
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
352 make_number (i->position + LENGTH (i)));
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
353 }
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
354
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
355 /* I's property has a different value -- change it */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
356 Fsetcar (this_cdr, val1);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
357 changed++;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
358 break;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
359 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
360
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
361 if (! found)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
362 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
363 /* Record this change in the buffer, for undo purposes. */
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
364 if (XTYPE (object) == Lisp_Buffer)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
365 {
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
366 record_property_change (i->position, LENGTH (i),
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
367 sym1, Qnil, object);
2783
789c11177579 The text property routines can now modify buffers other
Jim Blandy <jimb@redhat.com>
parents: 2762
diff changeset
368 modify_region (XBUFFER (object),
789c11177579 The text property routines can now modify buffers other
Jim Blandy <jimb@redhat.com>
parents: 2762
diff changeset
369 make_number (i->position),
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
370 make_number (i->position + LENGTH (i)));
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
371 }
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
372 i->plist = Fcons (sym1, Fcons (val1, i->plist));
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
373 changed++;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
374 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
375 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
376
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
377 return changed;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
378 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
379
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
380 /* For any members of PLIST which are properties of I, remove them
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
381 from I's plist.
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
382 OBJECT is the string or buffer containing I. */
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
383
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
384 static int
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
385 remove_properties (plist, i, object)
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
386 Lisp_Object plist;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
387 INTERVAL i;
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
388 Lisp_Object object;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
389 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
390 register Lisp_Object tail1, tail2, sym;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
391 register Lisp_Object current_plist = i->plist;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
392 register int changed = 0;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
393
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
394 /* Go through each element of plist. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
395 for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
396 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
397 sym = Fcar (tail1);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
398
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
399 /* First, remove the symbol if its at the head of the list */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
400 while (! NILP (current_plist) && EQ (sym, Fcar (current_plist)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
401 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
402 if (XTYPE (object) == Lisp_Buffer)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
403 {
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
404 record_property_change (i->position, LENGTH (i),
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
405 sym, Fcar (Fcdr (current_plist)),
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
406 object);
2783
789c11177579 The text property routines can now modify buffers other
Jim Blandy <jimb@redhat.com>
parents: 2762
diff changeset
407 modify_region (XBUFFER (object),
789c11177579 The text property routines can now modify buffers other
Jim Blandy <jimb@redhat.com>
parents: 2762
diff changeset
408 make_number (i->position),
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
409 make_number (i->position + LENGTH (i)));
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
410 }
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
411
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
412 current_plist = Fcdr (Fcdr (current_plist));
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
413 changed++;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
414 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
415
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
416 /* Go through i's plist, looking for sym */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
417 tail2 = current_plist;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
418 while (! NILP (tail2))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
419 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
420 register Lisp_Object this = Fcdr (Fcdr (tail2));
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
421 if (EQ (sym, Fcar (this)))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
422 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
423 if (XTYPE (object) == Lisp_Buffer)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
424 {
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
425 record_property_change (i->position, LENGTH (i),
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
426 sym, Fcar (Fcdr (this)), object);
2783
789c11177579 The text property routines can now modify buffers other
Jim Blandy <jimb@redhat.com>
parents: 2762
diff changeset
427 modify_region (XBUFFER (object),
789c11177579 The text property routines can now modify buffers other
Jim Blandy <jimb@redhat.com>
parents: 2762
diff changeset
428 make_number (i->position),
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
429 make_number (i->position + LENGTH (i)));
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
430 }
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
431
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
432 Fsetcdr (Fcdr (tail2), Fcdr (Fcdr (this)));
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
433 changed++;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
434 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
435 tail2 = this;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
436 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
437 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
438
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
439 if (changed)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
440 i->plist = current_plist;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
441 return changed;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
442 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
443
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
444 #if 0
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
445 /* Remove all properties from interval I. Return non-zero
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
446 if this changes the interval. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
447
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
448 static INLINE int
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
449 erase_properties (i)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
450 INTERVAL i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
451 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
452 if (NILP (i->plist))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
453 return 0;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
454
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
455 i->plist = Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
456 return 1;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
457 }
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
458 #endif
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
459
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
460 DEFUN ("text-properties-at", Ftext_properties_at,
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
461 Stext_properties_at, 1, 2, 0,
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
462 "Return the list of properties held by the character at POSITION\n\
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
463 in optional argument OBJECT, a string or buffer. If nil, OBJECT\n\
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
464 defaults to the current buffer.\n\
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
465 If POSITION is at the end of OBJECT, the value is nil.")
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
466 (pos, object)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
467 Lisp_Object pos, object;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
468 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
469 register INTERVAL i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
470
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
471 if (NILP (object))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
472 XSET (object, Lisp_Buffer, current_buffer);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
473
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
474 i = validate_interval_range (object, &pos, &pos, soft);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
475 if (NULL_INTERVAL_P (i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
476 return Qnil;
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
477 /* If POS is at the end of the interval,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
478 it means it's the end of OBJECT.
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
479 There are no properties at the very end,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
480 since no character follows. */
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
481 if (XINT (pos) == LENGTH (i) + i->position)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
482 return Qnil;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
483
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
484 return i->plist;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
485 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
486
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
487 DEFUN ("get-text-property", Fget_text_property, Sget_text_property, 2, 3, 0,
1930
1cdbdbe2f70a * textprop.c (Fget_text_property): Fix typo in function's declaration.
Jim Blandy <jimb@redhat.com>
parents: 1857
diff changeset
488 "Return the value of position POS's property PROP, in OBJECT.\n\
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
489 OBJECT is optional and defaults to the current buffer.\n\
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
490 If POSITION is at the end of OBJECT, the value is nil.")
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
491 (pos, prop, object)
1930
1cdbdbe2f70a * textprop.c (Fget_text_property): Fix typo in function's declaration.
Jim Blandy <jimb@redhat.com>
parents: 1857
diff changeset
492 Lisp_Object pos, object;
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
493 register Lisp_Object prop;
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
494 {
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
495 register INTERVAL i;
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
496 register Lisp_Object tail;
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
497
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
498 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
499 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
500 i = validate_interval_range (object, &pos, &pos, soft);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
501 if (NULL_INTERVAL_P (i))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
502 return Qnil;
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
503
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
504 /* If POS is at the end of the interval,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
505 it means it's the end of OBJECT.
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
506 There are no properties at the very end,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
507 since no character follows. */
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
508 if (XINT (pos) == LENGTH (i) + i->position)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
509 return Qnil;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
510
2058
a43d0bb1b7d8 (Fget_text_property): Use textget.
Richard M. Stallman <rms@gnu.org>
parents: 2053
diff changeset
511 return textget (i->plist, prop);
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
512 }
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
513
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
514 DEFUN ("next-property-change", Fnext_property_change,
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
515 Snext_property_change, 1, 2, 0,
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
516 "Return the position of next property change.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
517 Scans characters forward from POS in OBJECT till it finds\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
518 a change in some text property, then returns the position of the change.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
519 The optional second argument OBJECT is the string or buffer to scan.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
520 Return nil if the property is constant all the way to the end of OBJECT.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
521 If the value is non-nil, it is a position greater than POS, never equal.")
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
522 (pos, object)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
523 Lisp_Object pos, object;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
524 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
525 register INTERVAL i, next;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
526
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
527 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
528 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
529
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
530 i = validate_interval_range (object, &pos, &pos, soft);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
531 if (NULL_INTERVAL_P (i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
532 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
533
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
534 next = next_interval (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
535 while (! NULL_INTERVAL_P (next) && intervals_equal (i, next))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
536 next = next_interval (next);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
537
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
538 if (NULL_INTERVAL_P (next))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
539 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
540
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
541 return next->position - (XTYPE (object) == Lisp_String);
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
542 ;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
543 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
544
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
545 DEFUN ("next-single-property-change", Fnext_single_property_change,
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
546 Snext_single_property_change, 1, 3, 0,
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
547 "Return the position of next property change for a specific property.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
548 Scans characters forward from POS till it finds\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
549 a change in the PROP property, then returns the position of the change.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
550 The optional third argument OBJECT is the string or buffer to scan.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
551 Return nil if the property is constant all the way to the end of OBJECT.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
552 If the value is non-nil, it is a position greater than POS, never equal.")
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
553 (pos, prop, object)
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
554 Lisp_Object pos, prop, object;
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
555 {
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
556 register INTERVAL i, next;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
557 register Lisp_Object here_val;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
558
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
559 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
560 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
561
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
562 i = validate_interval_range (object, &pos, &pos, soft);
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
563 if (NULL_INTERVAL_P (i))
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
564 return Qnil;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
565
2762
dd28ed1e1928 * textprop.c (Fnext_single_property_change,
Jim Blandy <jimb@redhat.com>
parents: 2124
diff changeset
566 here_val = textget (i->plist, prop);
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
567 next = next_interval (i);
2762
dd28ed1e1928 * textprop.c (Fnext_single_property_change,
Jim Blandy <jimb@redhat.com>
parents: 2124
diff changeset
568 while (! NULL_INTERVAL_P (next)
dd28ed1e1928 * textprop.c (Fnext_single_property_change,
Jim Blandy <jimb@redhat.com>
parents: 2124
diff changeset
569 && EQ (here_val, textget (next->plist, prop)))
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
570 next = next_interval (next);
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
571
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
572 if (NULL_INTERVAL_P (next))
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
573 return Qnil;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
574
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
575 return next->position - (XTYPE (object) == Lisp_String);
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
576 }
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
577
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
578 DEFUN ("previous-property-change", Fprevious_property_change,
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
579 Sprevious_property_change, 1, 2, 0,
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
580 "Return the position of previous property change.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
581 Scans characters backwards from POS in OBJECT till it finds\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
582 a change in some text property, then returns the position of the change.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
583 The optional second argument OBJECT is the string or buffer to scan.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
584 Return nil if the property is constant all the way to the start of OBJECT.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
585 If the value is non-nil, it is a position less than POS, never equal.")
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
586 (pos, object)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
587 Lisp_Object pos, object;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
588 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
589 register INTERVAL i, previous;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
590
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
591 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
592 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
593
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
594 i = validate_interval_range (object, &pos, &pos, soft);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
595 if (NULL_INTERVAL_P (i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
596 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
597
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
598 previous = previous_interval (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
599 while (! NULL_INTERVAL_P (previous) && intervals_equal (previous, i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
600 previous = previous_interval (previous);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
601 if (NULL_INTERVAL_P (previous))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
602 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
603
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
604 return (previous->position + LENGTH (previous) - 1
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
605 - (XTYPE (object) == Lisp_String));
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
606 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
607
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
608 DEFUN ("previous-single-property-change", Fprevious_single_property_change,
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
609 Sprevious_single_property_change, 2, 3, 0,
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
610 "Return the position of previous property change for a specific property.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
611 Scans characters backward from POS till it finds\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
612 a change in the PROP property, then returns the position of the change.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
613 The optional third argument OBJECT is the string or buffer to scan.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
614 Return nil if the property is constant all the way to the start of OBJECT.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
615 If the value is non-nil, it is a position less than POS, never equal.")
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
616 (pos, prop, object)
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
617 Lisp_Object pos, prop, object;
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
618 {
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
619 register INTERVAL i, previous;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
620 register Lisp_Object here_val;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
621
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
622 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
623 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
624
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
625 i = validate_interval_range (object, &pos, &pos, soft);
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
626 if (NULL_INTERVAL_P (i))
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
627 return Qnil;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
628
2762
dd28ed1e1928 * textprop.c (Fnext_single_property_change,
Jim Blandy <jimb@redhat.com>
parents: 2124
diff changeset
629 here_val = textget (i->plist, prop);
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
630 previous = previous_interval (i);
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
631 while (! NULL_INTERVAL_P (previous)
2762
dd28ed1e1928 * textprop.c (Fnext_single_property_change,
Jim Blandy <jimb@redhat.com>
parents: 2124
diff changeset
632 && EQ (here_val, textget (previous->plist, prop)))
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
633 previous = previous_interval (previous);
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
634 if (NULL_INTERVAL_P (previous))
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
635 return Qnil;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
636
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
637 return (previous->position + LENGTH (previous) - 1
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
638 - (XTYPE (object) == Lisp_String));
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
639 }
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
640
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
641 DEFUN ("add-text-properties", Fadd_text_properties,
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
642 Sadd_text_properties, 3, 4, 0,
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
643 "Add properties to the text from START to END.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
644 The third argument PROPS is a property list\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
645 specifying the property values to add.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
646 The optional fourth argument, OBJECT,\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
647 is the string or buffer containing the text.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
648 Return t if any property value actually changed, nil otherwise.")
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
649 (start, end, properties, object)
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
650 Lisp_Object start, end, properties, object;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
651 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
652 register INTERVAL i, unchanged;
2124
54179ef9ce35 * textprop.c (Fadd_text_properties): Initialize the modified flag.
Jim Blandy <jimb@redhat.com>
parents: 2058
diff changeset
653 register int s, len, modified = 0;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
654
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
655 properties = validate_plist (properties);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
656 if (NILP (properties))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
657 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
658
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
659 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
660 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
661
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
662 i = validate_interval_range (object, &start, &end, hard);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
663 if (NULL_INTERVAL_P (i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
664 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
665
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
666 s = XINT (start);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
667 len = XINT (end) - s;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
668
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
669 /* If we're not starting on an interval boundary, we have to
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
670 split this interval. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
671 if (i->position != s)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
672 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
673 /* If this interval already has the properties, we can
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
674 skip it. */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
675 if (interval_has_all_properties (properties, i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
676 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
677 int got = (LENGTH (i) - (s - i->position));
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
678 if (got >= len)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
679 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
680 len -= got;
3858
e07d474bdba9 (Fremove_text_properties, Fadd_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 3698
diff changeset
681 i = next_interval (i);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
682 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
683 else
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
684 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
685 unchanged = i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
686 i = split_interval_right (unchanged, s - unchanged->position + 1);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
687 copy_properties (unchanged, i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
688 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
689 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
690
3553
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
691 /* We are at the beginning of interval I, with LEN chars to scan. */
2124
54179ef9ce35 * textprop.c (Fadd_text_properties): Initialize the modified flag.
Jim Blandy <jimb@redhat.com>
parents: 2058
diff changeset
692 for (;;)
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
693 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
694 if (i == 0)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
695 abort ();
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
696
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
697 if (LENGTH (i) >= len)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
698 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
699 if (interval_has_all_properties (properties, i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
700 return modified ? Qt : Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
701
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
702 if (LENGTH (i) == len)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
703 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
704 add_properties (properties, i, object);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
705 return Qt;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
706 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
707
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
708 /* i doesn't have the properties, and goes past the change limit */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
709 unchanged = i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
710 i = split_interval_left (unchanged, len + 1);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
711 copy_properties (unchanged, i);
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
712 add_properties (properties, i, object);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
713 return Qt;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
714 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
715
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
716 len -= LENGTH (i);
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
717 modified += add_properties (properties, i, object);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
718 i = next_interval (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
719 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
720 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
721
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
722 DEFUN ("put-text-property", Fput_text_property,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
723 Sput_text_property, 4, 5, 0,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
724 "Set one property of the text from START to END.\n\
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
725 The third and fourth arguments PROP and VALUE\n\
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
726 specify the property to add.\n\
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
727 The optional fifth argument, OBJECT,\n\
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
728 is the string or buffer containing the text.")
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
729 (start, end, prop, value, object)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
730 Lisp_Object start, end, prop, value, object;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
731 {
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
732 Fadd_text_properties (start, end,
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
733 Fcons (prop, Fcons (value, Qnil)),
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
734 object);
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
735 return Qnil;
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
736 }
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
737
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
738 DEFUN ("set-text-properties", Fset_text_properties,
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
739 Sset_text_properties, 3, 4, 0,
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
740 "Completely replace properties of text from START to END.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
741 The third argument PROPS is the new property list.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
742 The optional fourth argument, OBJECT,\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
743 is the string or buffer containing the text.")
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
744 (start, end, props, object)
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
745 Lisp_Object start, end, props, object;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
746 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
747 register INTERVAL i, unchanged;
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
748 register INTERVAL prev_changed = NULL_INTERVAL;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
749 register int s, len;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
750
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
751 props = validate_plist (props);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
752
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
753 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
754 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
755
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
756 i = validate_interval_range (object, &start, &end, hard);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
757 if (NULL_INTERVAL_P (i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
758 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
759
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
760 s = XINT (start);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
761 len = XINT (end) - s;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
762
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
763 if (i->position != s)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
764 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
765 unchanged = i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
766 i = split_interval_right (unchanged, s - unchanged->position + 1);
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
767
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
768 if (LENGTH (i) > len)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
769 {
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
770 copy_properties (unchanged, i);
3553
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
771 i = split_interval_left (i, len + 1);
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
772 set_properties (props, i, object);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
773 return Qt;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
774 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
775
3553
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
776 set_properties (props, i, object);
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
777
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
778 if (LENGTH (i) == len)
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
779 return Qt;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
780
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
781 prev_changed = i;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
782 len -= LENGTH (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
783 i = next_interval (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
784 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
785
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
786 /* We are starting at the beginning of an interval, I */
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
787 while (len > 0)
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
788 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
789 if (i == 0)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
790 abort ();
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
791
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
792 if (LENGTH (i) >= len)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
793 {
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
794 if (LENGTH (i) > len)
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
795 i = split_interval_left (i, len + 1);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
796
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
797 if (NULL_INTERVAL_P (prev_changed))
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
798 set_properties (props, i, object);
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
799 else
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
800 merge_interval_left (i);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
801 return Qt;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
802 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
803
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
804 len -= LENGTH (i);
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
805 if (NULL_INTERVAL_P (prev_changed))
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
806 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
807 set_properties (props, i, object);
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
808 prev_changed = i;
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
809 }
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
810 else
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
811 prev_changed = i = merge_interval_left (i);
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
812
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
813 i = next_interval (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
814 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
815
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
816 return Qt;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
817 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
818
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
819 DEFUN ("remove-text-properties", Fremove_text_properties,
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
820 Sremove_text_properties, 3, 4, 0,
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
821 "Remove some properties from text from START to END.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
822 The third argument PROPS is a property list\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
823 whose property names specify the properties to remove.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
824 \(The values stored in PROPS are ignored.)\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
825 The optional fourth argument, OBJECT,\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
826 is the string or buffer containing the text.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
827 Return t if any property was actually removed, nil otherwise.")
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
828 (start, end, props, object)
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
829 Lisp_Object start, end, props, object;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
830 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
831 register INTERVAL i, unchanged;
2124
54179ef9ce35 * textprop.c (Fadd_text_properties): Initialize the modified flag.
Jim Blandy <jimb@redhat.com>
parents: 2058
diff changeset
832 register int s, len, modified = 0;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
833
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
834 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
835 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
836
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
837 i = validate_interval_range (object, &start, &end, soft);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
838 if (NULL_INTERVAL_P (i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
839 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
840
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
841 s = XINT (start);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
842 len = XINT (end) - s;
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
843
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
844 if (i->position != s)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
845 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
846 /* No properties on this first interval -- return if
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
847 it covers the entire region. */
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
848 if (! interval_has_some_properties (props, i))
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
849 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
850 int got = (LENGTH (i) - (s - i->position));
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
851 if (got >= len)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
852 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
853 len -= got;
3858
e07d474bdba9 (Fremove_text_properties, Fadd_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 3698
diff changeset
854 i = next_interval (i);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
855 }
3553
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
856 /* Split away the beginning of this interval; what we don't
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
857 want to modify. */
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
858 else
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
859 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
860 unchanged = i;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
861 i = split_interval_right (unchanged, s - unchanged->position + 1);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
862 copy_properties (unchanged, i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
863 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
864 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
865
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
866 /* We are at the beginning of an interval, with len to scan */
2124
54179ef9ce35 * textprop.c (Fadd_text_properties): Initialize the modified flag.
Jim Blandy <jimb@redhat.com>
parents: 2058
diff changeset
867 for (;;)
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
868 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
869 if (i == 0)
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
870 abort ();
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
871
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
872 if (LENGTH (i) >= len)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
873 {
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
874 if (! interval_has_some_properties (props, i))
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
875 return modified ? Qt : Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
876
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
877 if (LENGTH (i) == len)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
878 {
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
879 remove_properties (props, i, object);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
880 return Qt;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
881 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
882
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
883 /* i has the properties, and goes past the change limit */
3553
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
884 unchanged = i;
5f9688c0b704 (Fadd_text_properties): Don't treat the initial
Richard M. Stallman <rms@gnu.org>
parents: 2783
diff changeset
885 i = split_interval_left (i, len + 1);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
886 copy_properties (unchanged, i);
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
887 remove_properties (props, i, object);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
888 return Qt;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
889 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
890
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
891 len -= LENGTH (i);
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
892 modified += remove_properties (props, i, object);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
893 i = next_interval (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
894 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
895 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
896
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
897 #if 0 /* You can use set-text-properties for this. */
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
898
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
899 DEFUN ("erase-text-properties", Ferase_text_properties,
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
900 Serase_text_properties, 2, 3, 0,
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
901 "Remove all properties from the text from START to END.\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
902 The optional third argument, OBJECT,\n\
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
903 is the string or buffer containing the text.")
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
904 (start, end, object)
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
905 Lisp_Object start, end, object;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
906 {
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
907 register INTERVAL i;
1305
5c19f71f0314 Fixed typeos.
Joseph Arceneaux <jla@gnu.org>
parents: 1302
diff changeset
908 register INTERVAL prev_changed = NULL_INTERVAL;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
909 register int s, len, modified;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
910
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
911 if (NILP (object))
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
912 XSET (object, Lisp_Buffer, current_buffer);
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
913
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
914 i = validate_interval_range (object, &start, &end, soft);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
915 if (NULL_INTERVAL_P (i))
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
916 return Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
917
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
918 s = XINT (start);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
919 len = XINT (end) - s;
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
920
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
921 if (i->position != s)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
922 {
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
923 register int got;
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
924 register INTERVAL unchanged = i;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
925
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
926 /* If there are properties here, then this text will be modified. */
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
927 if (! NILP (i->plist))
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
928 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
929 i = split_interval_right (unchanged, s - unchanged->position + 1);
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
930 i->plist = Qnil;
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
931 modified++;
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
932
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
933 if (LENGTH (i) > len)
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
934 {
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
935 i = split_interval_right (i, len + 1);
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
936 copy_properties (unchanged, i);
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
937 return Qt;
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
938 }
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
939
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
940 if (LENGTH (i) == len)
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
941 return Qt;
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
942
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
943 got = LENGTH (i);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
944 }
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
945 /* If the text of I is without any properties, and contains
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
946 LEN or more characters, then we may return without changing
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
947 anything.*/
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
948 else if (LENGTH (i) - (s - i->position) <= len)
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
949 return Qnil;
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
950 /* The amount of text to change extends past I, so just note
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
951 how much we've gotten. */
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
952 else
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
953 got = LENGTH (i) - (s - i->position);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
954
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
955 len -= got;
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
956 prev_changed = i;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
957 i = next_interval (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
958 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
959
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
960 /* We are starting at the beginning of an interval, I. */
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
961 while (len > 0)
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
962 {
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
963 if (LENGTH (i) >= len)
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
964 {
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
965 /* If I has no properties, simply merge it if possible. */
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
966 if (NILP (i->plist))
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
967 {
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
968 if (! NULL_INTERVAL_P (prev_changed))
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
969 merge_interval_left (i);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
970
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
971 return modified ? Qt : Qnil;
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
972 }
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
973
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
974 if (LENGTH (i) > len)
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
975 i = split_interval_left (i, len + 1);
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
976 if (! NULL_INTERVAL_P (prev_changed))
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
977 merge_interval_left (i);
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
978 else
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
979 i->plist = Qnil;
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
980
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
981 return Qt;
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
982 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
983
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
984 /* Here if we still need to erase past the end of I */
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
985 len -= LENGTH (i);
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
986 if (NULL_INTERVAL_P (prev_changed))
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
987 {
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
988 modified += erase_properties (i);
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
989 prev_changed = i;
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
990 }
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
991 else
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
992 {
1283
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
993 modified += ! NILP (i->plist);
6f4cbcc62eba Minor optimizations of Fset_text_properties and Ferase_text_properties.
Joseph Arceneaux <jla@gnu.org>
parents: 1272
diff changeset
994 /* Merging I will give it the properties of PREV_CHANGED. */
1272
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
995 prev_changed = i = merge_interval_left (i);
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
996 }
bfd04f61eb16 Mods to Ferase_text_properties
Joseph Arceneaux <jla@gnu.org>
parents: 1211
diff changeset
997
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
998 i = next_interval (i);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
999 }
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1000
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1001 return modified ? Qt : Qnil;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1002 }
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
1003 #endif /* 0 */
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1004
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1005 void
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1006 syms_of_textprop ()
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1007 {
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1008 DEFVAR_INT ("interval-balance-threshold", &interval_balance_threshold,
1715
cd23f7ef1bd0 * floatfns.c (Flog): Fix unescaped newline in string.
Jim Blandy <jimb@redhat.com>
parents: 1305
diff changeset
1009 "Threshold for rebalancing interval trees, expressed as the\n\
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1010 percentage by which the left interval tree should not differ from the right.");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1011 interval_balance_threshold = 8;
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1012
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1013 /* Common attributes one might give text */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1014
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1015 staticpro (&Qforeground);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1016 Qforeground = intern ("foreground");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1017 staticpro (&Qbackground);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1018 Qbackground = intern ("background");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1019 staticpro (&Qfont);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1020 Qfont = intern ("font");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1021 staticpro (&Qstipple);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1022 Qstipple = intern ("stipple");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1023 staticpro (&Qunderline);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1024 Qunderline = intern ("underline");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1025 staticpro (&Qread_only);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1026 Qread_only = intern ("read-only");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1027 staticpro (&Qinvisible);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1028 Qinvisible = intern ("invisible");
2058
a43d0bb1b7d8 (Fget_text_property): Use textget.
Richard M. Stallman <rms@gnu.org>
parents: 2053
diff changeset
1029 staticpro (&Qcategory);
a43d0bb1b7d8 (Fget_text_property): Use textget.
Richard M. Stallman <rms@gnu.org>
parents: 2053
diff changeset
1030 Qcategory = intern ("category");
a43d0bb1b7d8 (Fget_text_property): Use textget.
Richard M. Stallman <rms@gnu.org>
parents: 2053
diff changeset
1031 staticpro (&Qlocal_map);
a43d0bb1b7d8 (Fget_text_property): Use textget.
Richard M. Stallman <rms@gnu.org>
parents: 2053
diff changeset
1032 Qlocal_map = intern ("local-map");
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1033
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1034 /* Properties that text might use to specify certain actions */
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1035
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1036 staticpro (&Qmouse_left);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1037 Qmouse_left = intern ("mouse-left");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1038 staticpro (&Qmouse_entered);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1039 Qmouse_entered = intern ("mouse-entered");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1040 staticpro (&Qpoint_left);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1041 Qpoint_left = intern ("point-left");
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1042 staticpro (&Qpoint_entered);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1043 Qpoint_entered = intern ("point-entered");
2053
8bdcc55ebd8f (Qmodification_hooks): Renamed from Qmodification.
Richard M. Stallman <rms@gnu.org>
parents: 1965
diff changeset
1044 staticpro (&Qmodification_hooks);
8bdcc55ebd8f (Qmodification_hooks): Renamed from Qmodification.
Richard M. Stallman <rms@gnu.org>
parents: 1965
diff changeset
1045 Qmodification_hooks = intern ("modification-hooks");
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1046
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1047 defsubr (&Stext_properties_at);
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
1048 defsubr (&Sget_text_property);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1049 defsubr (&Snext_property_change);
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
1050 defsubr (&Snext_single_property_change);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1051 defsubr (&Sprevious_property_change);
1211
9f50cccf5963 See ChangeLog
Joseph Arceneaux <jla@gnu.org>
parents: 1055
diff changeset
1052 defsubr (&Sprevious_single_property_change);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1053 defsubr (&Sadd_text_properties);
1965
2bdbd6ed2430 (Fadd_text_properties, Fremove_text_properties):
Richard M. Stallman <rms@gnu.org>
parents: 1930
diff changeset
1054 defsubr (&Sput_text_property);
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1055 defsubr (&Sset_text_properties);
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1056 defsubr (&Sremove_text_properties);
1857
9d65dfc7bdb7 (Fadd_text_properties): Put OBJECT arg last. Make it optional.
Richard M. Stallman <rms@gnu.org>
parents: 1715
diff changeset
1057 /* defsubr (&Serase_text_properties); */
1029
425f62908a54 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1058 }
1302
538cc0cd6d83 * textprop.c: Conditionalize all functions on
Joseph Arceneaux <jla@gnu.org>
parents: 1283
diff changeset
1059
538cc0cd6d83 * textprop.c: Conditionalize all functions on
Joseph Arceneaux <jla@gnu.org>
parents: 1283
diff changeset
1060 #else
538cc0cd6d83 * textprop.c: Conditionalize all functions on
Joseph Arceneaux <jla@gnu.org>
parents: 1283
diff changeset
1061
538cc0cd6d83 * textprop.c: Conditionalize all functions on
Joseph Arceneaux <jla@gnu.org>
parents: 1283
diff changeset
1062 lose -- this shouldn't be compiled if USE_TEXT_PROPERTIES isn't defined
538cc0cd6d83 * textprop.c: Conditionalize all functions on
Joseph Arceneaux <jla@gnu.org>
parents: 1283
diff changeset
1063
538cc0cd6d83 * textprop.c: Conditionalize all functions on
Joseph Arceneaux <jla@gnu.org>
parents: 1283
diff changeset
1064 #endif /* USE_TEXT_PROPERTIES */