changeset 3696:aa9310f06c0f

(syms_of_undo): Set up Qinhibit_read_only. (Fprimitive_undo): Sometimes bind inhibit-read-only to t.
author Richard M. Stallman <rms@gnu.org>
date Sat, 12 Jun 1993 18:10:20 +0000
parents 674fb551b693
children 994bb6dc9249
files src/undo.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/undo.c	Sat Jun 12 17:46:44 1993 +0000
+++ b/src/undo.c	Sat Jun 12 18:10:20 1993 +0000
@@ -26,6 +26,8 @@
 /* Last buffer for which undo information was recorded.  */
 Lisp_Object last_undo_buffer;
 
+Lisp_Object Qinhibit_read_only;
+
 /* Record an insertion that just happened or is about to happen,
    for LENGTH characters at position BEG.
    (It is possible to record an insertion before or after the fact
@@ -286,6 +288,7 @@
   (count, list)
      Lisp_Object count, list;
 {
+  int count = specpdl_ptr - specpdl;
   register int arg = XINT (count);
 #if 0  /* This is a good feature, but would make undo-start
 	  unable to do what is expected.  */
@@ -298,6 +301,10 @@
     list = Fcdr (list);
 #endif
 
+  /* Don't let read-only properties interfere with undo.  */
+  if (NILP (current_buffer->read_only))
+    specbind (Qinhibit_read_only, Qt);
+
   while (arg > 0)
     {
       while (1)
@@ -401,11 +408,14 @@
       arg--;
     }
 
-  return list;
+  return unbind_to (count, list);
 }
 
 syms_of_undo ()
 {
+  Qinhibit_read_only = intern ("inhibit-read-only");
+  staticpro (&Qinhibit_read_only);
+
   defsubr (&Sprimitive_undo);
   defsubr (&Sundo_boundary);
 }