to by BEGIN and END may be integers or markers; if the latter, they
are coerced to integers.
- When OBJECT is a string, we increment *BEGIN and *END
- to make them origin-one.
-
Note that buffer points don't correspond to interval indices.
For example, point-max is 1 greater than the index of the last
character. This difference is handled in the caller, which uses
if (! (0 <= XFIXNUM (*begin) && XFIXNUM (*begin) <= XFIXNUM (*end)
&& XFIXNUM (*end) <= len))
args_out_of_range (*begin, *end);
- XSETFASTINT (*begin, XFIXNAT (*begin));
- if (begin != end)
- XSETFASTINT (*end, XFIXNAT (*end));
i = string_intervals (object);
if (len == 0)
set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties,
Lisp_Object object, Lisp_Object coherent_change_p)
{
- register INTERVAL i;
- Lisp_Object ostart, oend;
+ INTERVAL i;
bool first_time = true;
- ostart = start;
- oend = end;
-
properties = validate_plist (properties);
if (NILP (object))
if (NILP (properties))
return Qnil;
- /* Restore the original START and END values
- because validate_interval_range increments them for strings. */
- start = ostart;
- end = oend;
-
i = validate_interval_range (object, &start, &end, hard);
/* This can return if start == end. */
if (!i)
copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src,
Lisp_Object pos, Lisp_Object dest, Lisp_Object prop)
{
- INTERVAL i;
- Lisp_Object res;
- Lisp_Object stuff;
- Lisp_Object plist;
- ptrdiff_t s, e, e2, p, len;
- bool modified = false;
-
- i = validate_interval_range (src, &start, &end, soft);
+ INTERVAL i = validate_interval_range (src, &start, &end, soft);
if (!i)
return Qnil;
CHECK_FIXNUM_COERCE_MARKER (pos);
- {
- Lisp_Object dest_start, dest_end;
-
- e = XFIXNUM (pos) + (XFIXNUM (end) - XFIXNUM (start));
- if (MOST_POSITIVE_FIXNUM < e)
- args_out_of_range (pos, end);
- dest_start = pos;
- XSETFASTINT (dest_end, e);
- /* Apply this to a copy of pos; it will try to increment its arguments,
- which we don't want. */
- validate_interval_range (dest, &dest_start, &dest_end, soft);
- }
- s = XFIXNUM (start);
- e = XFIXNUM (end);
- p = XFIXNUM (pos);
+ EMACS_INT dest_e = XFIXNUM (pos) + (XFIXNUM (end) - XFIXNUM (start));
+ if (MOST_POSITIVE_FIXNUM < dest_e)
+ args_out_of_range (pos, end);
+ Lisp_Object dest_end = make_fixnum (dest_e);
+ validate_interval_range (dest, &pos, &dest_end, soft);
- stuff = Qnil;
+ ptrdiff_t s = XFIXNUM (start), e = XFIXNUM (end), p = XFIXNUM (pos);
+
+ Lisp_Object stuff = Qnil;
while (s < e)
{
- e2 = i->position + LENGTH (i);
+ ptrdiff_t e2 = i->position + LENGTH (i);
if (e2 > e)
e2 = e;
- len = e2 - s;
+ ptrdiff_t len = e2 - s;
- plist = i->plist;
+ Lisp_Object plist = i->plist;
if (! NILP (prop))
while (! NILP (plist))
{
s = i->position;
}
+ bool modified = false;
+
while (! NILP (stuff))
{
- res = Fcar (stuff);
+ Lisp_Object res = Fcar (stuff);
res = Fadd_text_properties (Fcar (res), Fcar (Fcdr (res)),
Fcar (Fcdr (Fcdr (res))), dest);
if (! NILP (res))