&& INTEGERP (XCDR (elt))
&& XINT (XCDR (elt)) == beg)
{
- XSETINT (XCDR (elt), beg + length);
+ XSETCDR (elt, make_number (beg + length));
return;
}
}
}
DEFUN ("undo-boundary", Fundo_boundary, Sundo_boundary, 0, 0, 0,
- "Mark a boundary between units of undo.\n\
-An undo command will stop at this point,\n\
-but another undo command will undo to the previous boundary.")
- ()
+ doc: /* Mark a boundary between units of undo.
+An undo command will stop at this point,
+but another undo command will undo to the previous boundary. */)
+ ()
{
Lisp_Object tem;
if (EQ (current_buffer->undo_list, Qt))
{
/* If we have preallocated the cons cell to use here,
use that one. */
- XCDR (pending_boundary) = current_buffer->undo_list;
+ XSETCDR (pending_boundary, current_buffer->undo_list);
current_buffer->undo_list = pending_boundary;
pending_boundary = Qnil;
}
/* Truncate at the boundary where we decided to truncate. */
if (!NILP (last_boundary))
{
- XCDR (last_boundary) = Qnil;
+ XSETCDR (last_boundary, Qnil);
return list;
}
else
}
\f
DEFUN ("primitive-undo", Fprimitive_undo, Sprimitive_undo, 2, 2, 0,
- "Undo N records from the front of the list LIST.\n\
-Return what remains of the list.")
- (n, list)
+ doc: /* Undo N records from the front of the list LIST.
+Return what remains of the list. */)
+ (n, list)
Lisp_Object n, list;
{
struct gcpro gcpro1, gcpro2;
Lisp_Object next;
- int count = specpdl_ptr - specpdl;
+ int count = BINDING_STACK_SIZE ();
register int arg;
+
#if 0 /* This is a good feature, but would make undo-start
unable to do what is expected. */
Lisp_Object tem;
next = Qnil;
GCPRO2 (next, list);
- /* Don't let read-only properties interfere with undo. */
- if (!NILP (current_buffer->read_only))
+ /* In a writable buffer, enable undoing read-only text that is so
+ because of text properties. */
+ if (NILP (current_buffer->read_only))
specbind (Qinhibit_read_only, Qt);
+ /* Don't let `intangible' properties interfere with undo. */
+ specbind (Qinhibit_point_motion_hooks, Qt);
+
while (arg > 0)
{
- while (1)
+ while (CONSP (list))
{
- next = Fcar (list);
- list = Fcdr (list);
+ next = XCAR (list);
+ list = XCDR (list);
/* Exit inner loop at undo boundary. */
if (NILP (next))
break;
{
Lisp_Object car, cdr;
- car = Fcar (next);
- cdr = Fcdr (next);
+ car = XCAR (next);
+ cdr = XCDR (next);
if (EQ (car, Qt))
{
/* Element (t high . low) records previous modtime. */
else if (INTEGERP (car) && INTEGERP (cdr))
{
/* Element (BEG . END) means range was inserted. */
- Lisp_Object end;
if (XINT (car) < BEGV
|| XINT (cdr) > ZV)