/* 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
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.")
- (count, list)
- Lisp_Object count, list;
+ (n, list)
+ Lisp_Object n, list;
{
- register int arg = XINT (count);
+ int count = specpdl_ptr - specpdl;
+ register int arg = XINT (n);
#if 0 /* This is a good feature, but would make undo-start
unable to do what is expected. */
Lisp_Object tem;
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)
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);
}