Lisp_Object interval_insert_behind_hooks;
Lisp_Object interval_insert_in_front_hooks;
+static void text_read_only P_ ((Lisp_Object)) NO_RETURN;
+
/* Signal a `text-read-only' error. This function makes it easier
to capture that error in GDB by putting a breakpoint on it. */
text_read_only (propval)
Lisp_Object propval;
{
- Fsignal (Qtext_read_only, STRINGP (propval) ? Fcons (propval, Qnil) : Qnil);
+ if (STRINGP (propval))
+ xsignal1 (Qtext_read_only, propval);
+
+ xsignal0 (Qtext_read_only);
}
DEFUN ("get-char-property-and-overlay", Fget_char_property_and_overlay,
Sget_char_property_and_overlay, 2, 3, 0,
doc: /* Like `get-char-property', but with extra overlay information.
-Return a cons whose car is the return value of `get-char-property'
-with the same arguments, that is, the value of POSITION's property
-PROP in OBJECT, and whose cdr is the overlay in which the property was
+The value is a cons cell. Its car is the return value of `get-char-property'
+with the same arguments--that is, the value of POSITION's property
+PROP in OBJECT. Its cdr is the overlay in which the property was
found, or nil, if it was found as a text property or not found at all.
+
OBJECT is optional and defaults to the current buffer. OBJECT may be
a string, a buffer or a window. For strings, the cdr of the return
value is always nil, since strings do not have overlays. If OBJECT is
&& (NILP (limit) || next->position < XFASTINT (limit)))
next = next_interval (next);
- if (NULL_INTERVAL_P (next))
- return limit;
- if (NILP (limit))
- XSETFASTINT (limit, (STRINGP (object)
- ? SCHARS (object)
- : BUF_ZV (XBUFFER (object))));
- if (!(next->position < XFASTINT (limit)))
+ if (NULL_INTERVAL_P (next)
+ || (next->position
+ >= (INTEGERP (limit)
+ ? XFASTINT (limit)
+ : (STRINGP (object)
+ ? SCHARS (object)
+ : BUF_ZV (XBUFFER (object))))))
return limit;
-
- XSETFASTINT (position, next->position);
- return position;
+ else
+ return make_number (next->position);
}
/* Return 1 if there's a change in some property between BEG and END. */
&& (NILP (limit) || next->position < XFASTINT (limit)))
next = next_interval (next);
- if (NULL_INTERVAL_P (next))
+ if (NULL_INTERVAL_P (next)
+ || (next->position
+ >= (INTEGERP (limit)
+ ? XFASTINT (limit)
+ : (STRINGP (object)
+ ? SCHARS (object)
+ : BUF_ZV (XBUFFER (object))))))
return limit;
- if (NILP (limit))
- XSETFASTINT (limit, (STRINGP (object)
- ? SCHARS (object)
- : BUF_ZV (XBUFFER (object))));
- if (!(next->position < XFASTINT (limit)))
- return limit;
-
- return make_number (next->position);
+ else
+ return make_number (next->position);
}
DEFUN ("previous-property-change", Fprevious_property_change,
&& (NILP (limit)
|| (previous->position + LENGTH (previous) > XFASTINT (limit))))
previous = previous_interval (previous);
- if (NULL_INTERVAL_P (previous))
- return limit;
- if (NILP (limit))
- XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))));
- if (!(previous->position + LENGTH (previous) > XFASTINT (limit)))
- return limit;
- return make_number (previous->position + LENGTH (previous));
+ if (NULL_INTERVAL_P (previous)
+ || (previous->position + LENGTH (previous)
+ <= (INTEGERP (limit)
+ ? XFASTINT (limit)
+ : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))))))
+ return limit;
+ else
+ return make_number (previous->position + LENGTH (previous));
}
DEFUN ("previous-single-property-change", Fprevious_single_property_change,
&& (NILP (limit)
|| (previous->position + LENGTH (previous) > XFASTINT (limit))))
previous = previous_interval (previous);
- if (NULL_INTERVAL_P (previous))
- return limit;
- if (NILP (limit))
- XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))));
- if (!(previous->position + LENGTH (previous) > XFASTINT (limit)))
- return limit;
- return make_number (previous->position + LENGTH (previous));
+ if (NULL_INTERVAL_P (previous)
+ || (previous->position + LENGTH (previous)
+ <= (INTEGERP (limit)
+ ? XFASTINT (limit)
+ : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))))))
+ return limit;
+ else
+ return make_number (previous->position + LENGTH (previous));
}
\f
/* Callers note, this can GC when OBJECT is a buffer (or nil). */
}
if (BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end));
+ modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
/* We are at the beginning of interval I, with LEN chars to scan. */
for (;;)
}
if (BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end));
+ modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
set_text_properties_1 (start, end, properties, object, i);
}
if (BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end));
+ modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
/* We are at the beginning of an interval, with len to scan */
for (;;)
if (LENGTH (i) == len)
{
if (!modified && BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end));
+ modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
i = split_interval_left (i, len);
copy_properties (unchanged, i);
if (!modified && BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end));
+ modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
if (interval_has_some_properties_list (properties, i))
{
if (!modified && BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end));
+ modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
remove_properties (Qnil, properties, i, object);
modified = 1;
}
/* PROP is rear-non-sticky. */
is_rear_sticky = 0;
}
+ else
+ return 0;
/* Consider following character. */
+ /* This signals an arg-out-of-range error if pos is outside the
+ buffer's accessible range. */
front_sticky = Fget_text_property (pos, Qfront_sticky, buffer);
if (EQ (front_sticky, Qt)