annotate lisp/utils/redo.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 8fc7fe29b841
children f53b5ca2e663
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
1 ;;; redo.el -- Redo/undo system for XEmacs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
2
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985, 1986, 1987, 1993-1995 Free Software Foundation, Inc.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
5 ;; Copyright (C) 1997 Kyle E. Jones
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
6
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
7 ;; Author: Kyle E. Jones, February 1997
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
8 ;; Keywords: lisp, extensions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
15 ;; any later version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
16
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20 ;; General Public License for more details.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
21
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
25 ;; 02111-1307, USA.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
26
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
27 ;;; Synched up with: Not in FSF.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
28
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
29 ;;; Commentary:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
30
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31 ;; Derived partly from lisp/prim/simple.el in XEmacs.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33 ;; Emacs' normal undo system allows you to undo an arbitrary
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 ;; number of buffer changes. These undos are recorded as ordinary
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35 ;; buffer changes themselves. So when you break the chain of
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 ;; undos by issuing some other command, you can then undo all
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
37 ;; the undos. The chain of recorded buffer modifications
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
38 ;; therefore grows without bound, truncated only at garbage
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 ;; collection time.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 ;; The redo/undo system is different in two ways:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42 ;; 1. The undo/redo command chain is only broken by a buffer
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 ;; modification. You can move around the buffer or switch
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;; buffers and still come back and do more undos or redos.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45 ;; 2. The `redo' command rescinds the most recent undo without
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 ;; recording the change as a _new_ buffer change. It
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 ;; completely reverses the effect of the undo, which
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;; includes making the chain of buffer modification records
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49 ;; shorter by one, to counteract the effect of the undo
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 ;; command making the record list longer by one.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52 ;; Installation:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 ;; Save this file as redo.el, byte compile it and put the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 ;; resulting redo.elc file in a directory that is listed in
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 ;; load-path.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 ;; In your .emacs file, add
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 ;; (require 'redo)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 ;; and the system will be enabled.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 ;;; Code:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 (provide 'redo)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
66 (defvar redo-version "1.01"
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 "Version number for the Redo package.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 (defvar last-buffer-undo-list nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70 "The head of buffer-undo-list at the last time an undo or redo was done.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 (make-variable-buffer-local 'last-buffer-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
73 (make-variable-buffer-local 'pending-undo-list)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
74
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 (defun redo (&optional count)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 "Redo the the most recent undo.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 Prefix arg COUNT means redo the COUNT most recent undos.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 If you have modified the buffer since the last redo or undo,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 then you cannot redo any undos before then."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80 (interactive "*p")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 (if (eq buffer-undo-list t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82 (error "No undo information in this buffer"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 (if (eq last-buffer-undo-list nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 (error "No undos to redo"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85 (or (eq last-buffer-undo-list buffer-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 (and (null (car-safe buffer-undo-list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 (eq last-buffer-undo-list (cdr-safe buffer-undo-list)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 (error "Buffer modified since last undo/redo, cannot redo"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 (and (or (eq buffer-undo-list pending-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 (eq (cdr buffer-undo-list) pending-undo-list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 (error "No further undos to redo in this buffer"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 (or (eq (selected-window) (minibuffer-window))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93 (message "Redo..."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 (let ((modified (buffer-modified-p))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 (recent-save (recent-auto-save-p))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96 (old-undo-list buffer-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 (p (cdr buffer-undo-list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98 (records-between 0))
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
99 ;; count the number of undo records between the head of the
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 ;; undo chain and the pointer to the next change. Note that
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101 ;; by `record' we mean clumps of change records, not the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102 ;; boundary records. The number of records will always be a
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 ;; multiple of 2, because an undo moves the pending pointer
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 ;; forward one record and prepend a record to the head of the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
105 ;; chain. Thus the separation always increases by two. WHen
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
106 ;; we decrease it we will decrease it by a multiple of 2
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107 ;; also.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 (while p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 (cond ((eq p pending-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 (setq p nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111 ((null (car p))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 (setq records-between (1+ records-between))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 (setq p (cdr p)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114 (t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 (setq p (cdr p)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 ;; we're off by one if pending pointer is nil, because there
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 ;; was no boundary record in front of it to count.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 (and (null pending-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119 (setq records-between (1+ records-between)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 ;; don't allow the user to redo more undos than exist.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 ;; only half the records between the list head and the pending
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 ;; pointer are undos that are a part of this command chain.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 (setq count (min (/ records-between 2) count)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 p (primitive-undo (1+ count) buffer-undo-list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 (if (eq p old-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 nil ;; nothing happened
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 ;; set buffer-undo-list to the new undo list. if has been
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 ;; shortened by `count' records.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 (setq buffer-undo-list p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 ;; primitive-undo returns a list without a leading undo
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 ;; boundary. add one.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 (undo-boundary)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 ;; now move the pending pointer backward in the undo list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134 ;; to reflect the redo. sure would be nice if this list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 ;; were doubly linked, but no... so we have to run down the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 ;; list from the head and stop at the right place.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 (let ((n (- records-between count)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 (setq p (cdr old-undo-list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 (while (and p (> n 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140 (if (null (car p))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141 (setq n (1- n)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 (setq p (cdr p)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 (setq pending-undo-list p)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 (and modified (not (buffer-modified-p))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 (delete-auto-save-file-if-necessary recent-save))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146 (or (eq (selected-window) (minibuffer-window))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 (message "Redo!"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 (setq last-buffer-undo-list buffer-undo-list)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 (defun undo (&optional arg)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 "Undo some previous changes.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 Repeat this command to undo more changes.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153 A numeric argument serves as a repeat count."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154 (interactive "*p")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155 (let ((modified (buffer-modified-p))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156 (recent-save (recent-auto-save-p)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157 (or (eq (selected-window) (minibuffer-window))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 (message "Undo..."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159 (or (eq last-buffer-undo-list buffer-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160 (and (null (car-safe buffer-undo-list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161 (eq last-buffer-undo-list (cdr-safe buffer-undo-list)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162 (progn (undo-start)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163 (undo-more 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 (undo-more (or arg 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165 ;; Don't specify a position in the undo record for the undo command.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166 ;; Instead, undoing this should move point to where the change is.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168 ;;;; The old code for this was mad! It deleted all set-point
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169 ;;;; references to the position from the whole undo list,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 ;;;; instead of just the cells from the beginning to the next
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 ;;;; undo boundary. This does what I think the other code
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 ;;;; meant to do.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 (let ((list buffer-undo-list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174 (prev nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 (while (and list (not (null (car list))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176 (if (integerp (car list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
177 (if prev
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
178 (setcdr prev (cdr list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
179 ;; impossible now, but maybe not in the future
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
180 (setq buffer-undo-list (cdr list))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
181 (setq prev list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
182 list (cdr list))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
183 (and modified (not (buffer-modified-p))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
184 (delete-auto-save-file-if-necessary recent-save)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
185 (or (eq (selected-window) (minibuffer-window))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
186 (message "Undo!"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
187 (setq last-buffer-undo-list buffer-undo-list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
188
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
189 ;;; redo.el ends here