From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Roland Winkler" Newsgroups: gmane.emacs.devel Subject: undoing changes automatically Date: Mon, 12 Nov 2007 02:13:01 +0100 Message-ID: <18231.43165.842097.720674@tfkp07.physik.uni-erlangen.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1194830008 6264 80.91.229.12 (12 Nov 2007 01:13:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Nov 2007 01:13:28 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 12 02:13:31 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IrNrm-000857-3w for ged-emacs-devel@m.gmane.org; Mon, 12 Nov 2007 02:13:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IrNrZ-0003DD-VH for ged-emacs-devel@m.gmane.org; Sun, 11 Nov 2007 20:13:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IrNrW-0003Cr-PR for emacs-devel@gnu.org; Sun, 11 Nov 2007 20:13:14 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IrNrW-0003CV-94 for emacs-devel@gnu.org; Sun, 11 Nov 2007 20:13:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IrNrW-0003CS-6K for emacs-devel@gnu.org; Sun, 11 Nov 2007 20:13:14 -0500 Original-Received: from tfkpsv.physik.uni-erlangen.de ([131.188.164.197]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IrNrV-00016H-TR for emacs-devel@gnu.org; Sun, 11 Nov 2007 20:13:14 -0500 Original-Received: from tfkp07.physik.uni-erlangen.de (tfkp07.physik.uni-erlangen.de [131.188.164.207]) by tfkpsv.physik.uni-erlangen.de (Postfix) with ESMTP id C62C5213A8 for ; Mon, 12 Nov 2007 02:13:08 +0100 (CET) X-Mailer: VM 7.19 under Emacs 22.1.2 X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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: news.gmane.org gmane.emacs.devel:83005 Archived-At: Who can please explain to me the following? bibtex.el contains the function bibtex-format-entry that performs various formatting operations on a BibTeX entry. Along the way, it also checks in several ways whether syntax and content of the entry are correct. It throws an error if any of these checks indicates that something is incorrect. But this happens while it is in the midst of its formatting job. This is very confusing because it leaves the buffer in an odd state. One always needs to do an `undo' after such an error message. So I want to put the call to undo in the code such that it undoes all the formatting before it throws the error. However, one thing confuses me: a simple call of `undo' is not enough. Instead, I need to call first `undo-boundary'. Why does `undo' ignore the latest entries in buffer-undo-list past (i.e., newer than) the last undo boundary? Is this behavior intended? If yes, is it documented somewhere? Thanks, Roland PS: I am also a bit unhappy that using the buffer-undo-list for this always makes this list grow, although there is no need to keep these entries in buffer-undo-list if they are undone immediately. So is there a cleaner way to achieve what I want? I have in mind something like a (noninteractive) undo function that deletes those entries from buffer-undo-list that are undone. (An alternative would be that the code performed first all the error checking and did the formatting afterwards. However, this would duplicate a lot of code and also duplicate work done in bibtex-format-entry. So I would like to avoid that.)