if (! EQ (property_value (properties, XCONS (sym)->car),
XCONS (value)->car))
{
- modify_region (XBUFFER (object),
- interval->position,
- interval->position + LENGTH (interval));
record_property_change (interval->position, LENGTH (interval),
XCONS (sym)->car, XCONS (value)->car,
object);
- signal_after_change (interval->position, LENGTH (interval),
- LENGTH (interval));
}
/* For each new property that has no value at all in the old plist,
sym = XCONS (value)->cdr)
if (EQ (property_value (interval->plist, XCONS (sym)->car), Qunbound))
{
- modify_region (XBUFFER (object),
- interval->position,
- interval->position + LENGTH (interval));
record_property_change (interval->position, LENGTH (interval),
XCONS (sym)->car, Qnil,
object);
- signal_after_change (interval->position, LENGTH (interval),
- LENGTH (interval));
}
}
/* Record this change in the buffer, for undo purposes. */
if (BUFFERP (object))
{
- modify_region (XBUFFER (object),
- i->position,
- i->position + LENGTH (i));
record_property_change (i->position, LENGTH (i),
sym1, Fcar (this_cdr), object);
- signal_after_change (i->position, LENGTH (i), LENGTH (i));
}
/* I's property has a different value -- change it */
/* Record this change in the buffer, for undo purposes. */
if (BUFFERP (object))
{
- modify_region (XBUFFER (object),
- i->position,
- i->position + LENGTH (i));
record_property_change (i->position, LENGTH (i),
sym1, Qnil, object);
- signal_after_change (i->position, LENGTH (i), LENGTH (i));
}
i->plist = Fcons (sym1, Fcons (val1, i->plist));
changed++;
{
if (BUFFERP (object))
{
- modify_region (XBUFFER (object),
- i->position,
- i->position + LENGTH (i));
record_property_change (i->position, LENGTH (i),
sym, Fcar (Fcdr (current_plist)),
object);
- signal_after_change (i->position, LENGTH (i), LENGTH (i));
}
current_plist = Fcdr (Fcdr (current_plist));
{
if (BUFFERP (object))
{
- modify_region (XBUFFER (object),
- i->position,
- i->position + LENGTH (i));
record_property_change (i->position, LENGTH (i),
sym, Fcar (Fcdr (this)), object);
- signal_after_change (i->position, LENGTH (i), LENGTH (i));
}
Fsetcdr (Fcdr (tail2), Fcdr (Fcdr (this)));
simpler case. */
return (Fget_text_property (position, prop, object));
}
+\f
+DEFUN ("next-char-property-change", Fnext_char_property_change,
+ Snext_char_property_change, 1, 2, 0,
+ "Return the position of next text property or overlay change.\n\
+This scans characters forward from POSITION in OBJECT till it finds\n\
+a change in some text property, or the beginning or end of an overlay,\n\
+and returns the position of that.\n\
+If none is found, the function returns (point-max).\n\
+\n\
+If the optional third argument LIMIT is non-nil, don't search\n\
+past position LIMIT; return LIMIT if nothing is found before LIMIT.")
+ (position, limit)
+ Lisp_Object position, limit;
+{
+ Lisp_Object temp;
+ temp = Fnext_overlay_change (position);
+ if (! NILP (limit))
+ {
+ CHECK_NUMBER (limit, 2);
+ if (XINT (limit) < XINT (temp))
+ temp = limit;
+ }
+ return Fnext_property_change (position, Qnil, temp);
+}
+
+DEFUN ("previous-char-property-change", Fprevious_char_property_change,
+ Sprevious_char_property_change, 1, 2, 0,
+ "Return the position of previous text property or overlay change.\n\
+Scans characters backward from POSITION in OBJECT till it finds\n\
+a change in some text property, or the beginning or end of an overlay,\n\
+and returns the position of that.\n\
+If none is found, the function returns (point-max).\n\
+\n\
+If the optional third argument LIMIT is non-nil, don't search\n\
+past position LIMIT; return LIMIT if nothing is found before LIMIT.")
+ (position, limit)
+ Lisp_Object position, limit;
+{
+ Lisp_Object temp;
+
+ temp = Fprevious_overlay_change (position);
+ if (! NILP (limit))
+ {
+ CHECK_NUMBER (limit, 2);
+ if (XINT (limit) > XINT (temp))
+ temp = limit;
+ }
+ return Fprevious_property_change (position, Qnil, temp);
+}
+\f
DEFUN ("next-property-change", Fnext_property_change,
Snext_property_change, 1, 3, 0,
"Return the position of next property change.\n\
- (STRINGP (object))));
return position;
}
-
+\f
/* Callers note, this can GC when OBJECT is a buffer (or nil). */
DEFUN ("add-text-properties", Fadd_text_properties,
}
}
+ if (BUFFERP (object))
+ modify_region (XBUFFER (object), XINT (start), XINT (end));
+
/* We are at the beginning of interval I, with LEN chars to scan. */
for (;;)
{
UNGCPRO;
if (interval_has_all_properties (properties, i))
- return modified ? Qt : Qnil;
+ {
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
+
+ return modified ? Qt : Qnil;
+ }
if (LENGTH (i) == len)
{
add_properties (properties, i, object);
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
return Qt;
}
i = split_interval_left (unchanged, len);
copy_properties (unchanged, i);
add_properties (properties, i, object);
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
return Qt;
}
register INTERVAL prev_changed = NULL_INTERVAL;
register int s, len;
Lisp_Object ostart, oend;
+ int have_modified = 0;
ostart = start;
oend = end;
&& XFASTINT (start) == 0
&& XFASTINT (end) == XSTRING (object)->size)
{
+ if (! XSTRING (object)->intervals)
+ return Qt;
+
XSTRING (object)->intervals = 0;
return Qt;
}
s = XINT (start);
len = XINT (end) - s;
+ if (BUFFERP (object))
+ modify_region (XBUFFER (object), XINT (start), XINT (end));
+
if (i->position != s)
{
unchanged = i;
copy_properties (unchanged, i);
i = split_interval_left (i, len);
set_properties (properties, i, object);
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
+
return Qt;
}
set_properties (properties, i, object);
if (LENGTH (i) == len)
- return Qt;
+ {
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
+
+ return Qt;
+ }
prev_changed = i;
len -= LENGTH (i);
set_properties (properties, i, object);
if (!NULL_INTERVAL_P (prev_changed))
merge_interval_left (i);
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
return Qt;
}
i = next_interval (i);
}
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
return Qt;
}
}
}
+ if (BUFFERP (object))
+ modify_region (XBUFFER (object), XINT (start), XINT (end));
+
/* We are at the beginning of an interval, with len to scan */
for (;;)
{
if (LENGTH (i) == len)
{
remove_properties (properties, i, object);
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
return Qt;
}
i = split_interval_left (i, len);
copy_properties (unchanged, i);
remove_properties (properties, i, object);
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
return Qt;
}
i = next_interval (i);
}
}
-
+\f
DEFUN ("text-property-any", Ftext_property_any,
Stext_property_any, 4, 5, 0,
"Check text from START to END for property PROPERTY equalling VALUE.\n\
}
return Qnil;
}
-
+\f
#if 0 /* You can use set-text-properties for this. */
DEFUN ("erase-text-properties", Ferase_text_properties,
Return t if any property value actually changed, nil otherwise. */
/* Note this can GC when DEST is a buffer. */
-
+\f
Lisp_Object
copy_text_properties (start, end, src, pos, dest, prop)
Lisp_Object start, end, src, pos, dest, prop;
defsubr (&Stext_properties_at);
defsubr (&Sget_text_property);
defsubr (&Sget_char_property);
+ defsubr (&Snext_char_property_change);
+ defsubr (&Sprevious_char_property_change);
defsubr (&Snext_property_change);
defsubr (&Snext_single_property_change);
defsubr (&Sprevious_property_change);