Change doc-string comments to `new style' [w/`doc:' keyword].
[bpt/emacs.git] / src / undo.c
index 31d7c39..0c87a59 100644 (file)
@@ -73,7 +73,7 @@ record_insert (beg, length)
          && INTEGERP (XCDR (elt))
          && XINT (XCDR (elt)) == beg)
        {
-         XSETINT (XCDR (elt), beg + length);
+         XSETCDR (elt, make_number (beg + length));
          return;
        }
     }
@@ -257,10 +257,10 @@ record_property_change (beg, length, prop, value, buffer)
 }
 
 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))
@@ -273,7 +273,7 @@ but another undo command will undo to the previous boundary.")
        {
          /* 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;
        }
@@ -378,7 +378,7 @@ truncate_undo_list (list, minsize, maxsize)
   /* Truncate at the boundary where we decided to truncate.  */
   if (!NILP (last_boundary))
     {
-      XCDR (last_boundary) = Qnil;
+      XSETCDR (last_boundary, Qnil);
       return list;
     }
   else
@@ -386,15 +386,16 @@ truncate_undo_list (list, minsize, maxsize)
 }
 \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;
@@ -411,16 +412,20 @@ Return what remains of the list.")
   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;
@@ -431,8 +436,8 @@ Return what remains of the list.")
            {
              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.  */
@@ -474,7 +479,6 @@ Return what remains of the list.")
              else if (INTEGERP (car) && INTEGERP (cdr))
                {
                  /* Element (BEG . END) means range was inserted.  */
-                 Lisp_Object end;
 
                  if (XINT (car) < BEGV
                      || XINT (cdr) > ZV)