[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/undo.c
From: |
Kim F . Storm |
Subject: |
[Emacs-diffs] Changes to emacs/src/undo.c |
Date: |
Mon, 07 Feb 2005 06:44:00 -0500 |
Index: emacs/src/undo.c
diff -c emacs/src/undo.c:1.68 emacs/src/undo.c:1.69
*** emacs/src/undo.c:1.68 Wed Feb 2 15:43:18 2005
--- emacs/src/undo.c Mon Feb 7 11:44:00 2005
***************
*** 1,5 ****
/* undo handling for GNU Emacs.
! Copyright (C) 1990, 1993, 1994, 2000 Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,6 ----
/* undo handling for GNU Emacs.
! Copyright (C) 1990, 1993, 1994, 2000, 2002, 2004, 2005
! Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 454,459 ****
--- 455,462 ----
Lisp_Object next;
int count = SPECPDL_INDEX ();
register int arg;
+ Lisp_Object oldlist;
+ int did_apply = 0;
#if 0 /* This is a good feature, but would make undo-start
unable to do what is expected. */
***************
*** 470,475 ****
--- 473,480 ----
arg = XINT (n);
next = Qnil;
GCPRO2 (next, list);
+ /* I don't think we need to gcpro oldlist, as we use it only
+ to check for EQ. ++kfs */
/* In a writable buffer, enable undoing read-only text that is so
because of text properties. */
***************
*** 479,484 ****
--- 484,491 ----
/* Don't let `intangible' properties interfere with undo. */
specbind (Qinhibit_point_motion_hooks, Qt);
+ oldlist = current_buffer->undo_list;
+
while (arg > 0)
{
while (CONSP (list))
***************
*** 549,555 ****
}
else if (EQ (car, Qapply))
{
- Lisp_Object oldlist = current_buffer->undo_list;
/* Element (apply FUNNAME . ARGS) means call FUNNAME to undo.
*/
car = Fcar (cdr);
if (INTEGERP (car))
--- 556,561 ----
***************
*** 560,572 ****
}
cdr = Fcdr (cdr);
apply1 (car, cdr);
!
! /* Make sure this produces at least one undo entry,
! so the test in `undo' for continuing an undo series
! will work right. */
! if (EQ (oldlist, current_buffer->undo_list))
! current_buffer->undo_list
! = Fcons (list3 (Qapply, Qcdr, Qnil),
current_buffer->undo_list);
}
else if (STRINGP (car) && INTEGERP (cdr))
{
--- 566,572 ----
}
cdr = Fcdr (cdr);
apply1 (car, cdr);
! did_apply = 1;
}
else if (STRINGP (car) && INTEGERP (cdr))
{
***************
*** 611,616 ****
--- 611,625 ----
arg--;
}
+
+ /* Make sure an apply entry produces at least one undo entry,
+ so the test in `undo' for continuing an undo series
+ will work right. */
+ if (did_apply
+ && EQ (oldlist, current_buffer->undo_list))
+ current_buffer->undo_list
+ = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list);
+
UNGCPRO;
return unbind_to (count, list);
}