src/textprop.c (Fadd_text_properties, Fremove_text_properties)
(Fremove_list_of_text_properties): Skip all of the intervals in
the region between START and END that already have resp. don't
have the requested properties, not just the first one. Add
assertions that the loop afterwards always modifies the
properties.
+2013-02-25 Eli Zaretskii <eliz@gnu.org>
+
+ * textprop.c (Fadd_text_properties, Fremove_text_properties)
+ (Fremove_list_of_text_properties): Skip all of the intervals in
+ the region between START and END that already have resp. don't
+ have the requested properties, not just the first one. Add
+ assertions that the loop afterwards always modifies the
+ properties. (Bug#13743)
+
2013-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
* callint.c (Fcall_interactively): Use the right lexical environment
2013-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
* callint.c (Fcall_interactively): Use the right lexical environment
register ptrdiff_t s, len;
register int modified = 0;
struct gcpro gcpro1;
register ptrdiff_t s, len;
register int modified = 0;
struct gcpro gcpro1;
properties = validate_plist (properties);
if (NILP (properties))
properties = validate_plist (properties);
if (NILP (properties))
and live buffers are always protected. */
GCPRO1 (properties);
and live buffers are always protected. */
GCPRO1 (properties);
- /* If we're not starting on an interval boundary, we have to
- split this interval. */
- if (i->position != s)
+ /* If this interval already has the properties, we can skip it. */
+ if (interval_has_all_properties (properties, i))
- /* If this interval already has the properties, we can
- skip it. */
- if (interval_has_all_properties (properties, i))
- {
- ptrdiff_t got = (LENGTH (i) - (s - i->position));
- if (got >= len)
- RETURN_UNGCPRO (Qnil);
- len -= got;
- i = next_interval (i);
- }
- else
- {
- unchanged = i;
- i = split_interval_right (unchanged, s - unchanged->position);
- copy_properties (unchanged, i);
- }
+ got = LENGTH (i) - (s - i->position);
+ do {
+ if (got >= len)
+ RETURN_UNGCPRO (Qnil);
+ len -= got;
+ i = next_interval (i);
+ got = LENGTH (i);
+ } while (interval_has_all_properties (properties, i));
+ }
+ else if (i->position != s)
+ {
+ /* If we're not starting on an interval boundary, we have to
+ split this interval. */
+ unchanged = i;
+ i = split_interval_right (unchanged, s - unchanged->position);
+ copy_properties (unchanged, i);
signal_after_change (XINT (start), XINT (end) - XINT (start),
XINT (end) - XINT (start));
signal_after_change (XINT (start), XINT (end) - XINT (start),
XINT (end) - XINT (start));
- return modified ? Qt : Qnil;
+ eassert (modified);
+ return Qt;
register INTERVAL i, unchanged;
register ptrdiff_t s, len;
register int modified = 0;
register INTERVAL i, unchanged;
register ptrdiff_t s, len;
register int modified = 0;
if (NILP (object))
XSETBUFFER (object, current_buffer);
if (NILP (object))
XSETBUFFER (object, current_buffer);
s = XINT (start);
len = XINT (end) - s;
s = XINT (start);
len = XINT (end) - s;
+ /* If there are no properties on this entire interval, return. */
+ if (! interval_has_some_properties (properties, i))
- /* No properties on this first interval -- return if
- it covers the entire region. */
- if (! interval_has_some_properties (properties, i))
- {
- ptrdiff_t got = (LENGTH (i) - (s - i->position));
- if (got >= len)
- return Qnil;
- len -= got;
- i = next_interval (i);
- }
- /* Split away the beginning of this interval; what we don't
- want to modify. */
- else
- {
- unchanged = i;
- i = split_interval_right (unchanged, s - unchanged->position);
- copy_properties (unchanged, i);
- }
+ got = (LENGTH (i) - (s - i->position));
+ do {
+ if (got >= len)
+ return Qnil;
+ len -= got;
+ i = next_interval (i);
+ got = LENGTH (i);
+ } while (! interval_has_some_properties (properties, i));
+ }
+ /* Split away the beginning of this interval; what we don't
+ want to modify. */
+ else if (i->position != s)
+ {
+ unchanged = i;
+ i = split_interval_right (unchanged, s - unchanged->position);
+ copy_properties (unchanged, i);
if (LENGTH (i) >= len)
{
if (! interval_has_some_properties (properties, i))
if (LENGTH (i) >= len)
{
if (! interval_has_some_properties (properties, i))
- return modified ? Qt : Qnil;
+ {
+ eassert (modified);
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
+ return Qt;
+ }
register ptrdiff_t s, len;
register int modified = 0;
Lisp_Object properties;
register ptrdiff_t s, len;
register int modified = 0;
Lisp_Object properties;
properties = list_of_properties;
if (NILP (object))
properties = list_of_properties;
if (NILP (object))
s = XINT (start);
len = XINT (end) - s;
s = XINT (start);
len = XINT (end) - s;
+ /* If there are no properties on the interval, return. */
+ if (! interval_has_some_properties_list (properties, i))
- /* No properties on this first interval -- return if
- it covers the entire region. */
- if (! interval_has_some_properties_list (properties, i))
- {
- ptrdiff_t got = (LENGTH (i) - (s - i->position));
- if (got >= len)
- return Qnil;
- len -= got;
- i = next_interval (i);
- }
- /* Split away the beginning of this interval; what we don't
- want to modify. */
- else
- {
- unchanged = i;
- i = split_interval_right (unchanged, s - unchanged->position);
- copy_properties (unchanged, i);
- }
+ got = (LENGTH (i) - (s - i->position));
+ do {
+ if (got >= len)
+ return Qnil;
+ len -= got;
+ i = next_interval (i);
+ got = LENGTH (i);
+ } while (! interval_has_some_properties_list (properties, i));
+ }
+ /* Split away the beginning of this interval; what we don't
+ want to modify. */
+ else if (i->position != s)
+ {
+ unchanged = i;
+ i = split_interval_right (unchanged, s - unchanged->position);
+ copy_properties (unchanged, i);
}
/* We are at the beginning of an interval, with len to scan.
}
/* We are at the beginning of an interval, with len to scan.