From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: timers and undo Date: Sun, 26 Dec 2004 23:09:53 -0500 Message-ID: References: <200412242232.iBOMWFd16657@raven.dms.auburn.edu> Reply-To: rms@gnu.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1104121033 2489 80.91.229.6 (27 Dec 2004 04:17:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 27 Dec 2004 04:17:13 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 27 05:17:07 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CimJf-0006v1-00 for ; Mon, 27 Dec 2004 05:17:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CimUR-00054G-NP for ged-emacs-devel@m.gmane.org; Sun, 26 Dec 2004 23:28:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CimSu-0004A1-C8 for emacs-devel@gnu.org; Sun, 26 Dec 2004 23:26:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CimSs-00048J-Ij for emacs-devel@gnu.org; Sun, 26 Dec 2004 23:26:38 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CimSs-00047R-2H for emacs-devel@gnu.org; Sun, 26 Dec 2004 23:26:38 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CimI4-0004Za-IA for emacs-devel@gnu.org; Sun, 26 Dec 2004 23:15:28 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1CimCf-0003IT-4y; Sun, 26 Dec 2004 23:09:53 -0500 Original-To: Luc Teirlinck In-reply-to: <200412242232.iBOMWFd16657@raven.dms.auburn.edu> (message from Luc Teirlinck on Fri, 24 Dec 2004 16:32:15 -0600 (CST)) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:31434 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:31434 Wait until once more a bunch of lines are inserted. I now expected that C-/ would get rid of these inserted lines once more. But no. It deletes the introductory comment lines. The "aaaaaaa" lines stay and they are impossible to undo after repaeting C-/ This is because it sees that the previous command was also `undo'. So it continues the undo sequence previously started. One fix is to make the command `undo' defensively notice that the undo list has changed since its previous execution. Does the fix below give good results? One drawback of this patch is that the space in the undo list will still be wasted if buffer-undo-list is cleared out *** simple.el 20 Dec 2004 15:37:08 -0500 1.673 --- simple.el 26 Dec 2004 15:12:32 -0500 *** 1215,1220 **** --- 1234,1243 ---- (defvar undo-no-redo nil "If t, `undo' doesn't go through redo entries.") + (defvar undo-list-saved nil + "The value of `buffer-undo-list' saved by the last undo command.") + (make-variable-buffer-local 'undo-list-saved) + (defun undo (&optional arg) "Undo some previous changes. Repeat this command to undo more changes. *************** *** 1237,1243 **** ;; So set `this-command' to something other than `undo'. (setq this-command 'undo-start) ! (unless (eq last-command 'undo) (setq undo-in-region (if transient-mark-mode mark-active (and arg (not (numberp arg))))) (if undo-in-region --- 1260,1267 ---- ;; So set `this-command' to something other than `undo'. (setq this-command 'undo-start) ! (unless (and (eq last-command 'undo) ! (eq undo-list-saved buffer-undo-list)) (setq undo-in-region (if transient-mark-mode mark-active (and arg (not (numberp arg))))) (if undo-in-region *************** *** 1289,1295 **** (setq tail (cdr tail))) (setq tail nil))) (setq prev tail tail (cdr tail)))) ! (and modified (not (buffer-modified-p)) (delete-auto-save-file-if-necessary recent-save)))) --- 1313,1319 ---- (setq tail (cdr tail))) (setq tail nil))) (setq prev tail tail (cdr tail)))) ! (setq saved-undo-list buffer-undo-list) (and modified (not (buffer-modified-p)) (delete-auto-save-file-if-necessary recent-save))))