From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: undoing changes automatically Date: Mon, 12 Nov 2007 21:12:57 +0100 Message-ID: <853avbp6ie.fsf@lola.goethe.zz> References: <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 X-Trace: ger.gmane.org 1194898408 15295 80.91.229.12 (12 Nov 2007 20:13:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Nov 2007 20:13:28 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Roland Winkler" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 12 21:13:33 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 1Irfet-0001Z5-6Q for ged-emacs-devel@m.gmane.org; Mon, 12 Nov 2007 21:13:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Irfeg-0002cw-Ra for ged-emacs-devel@m.gmane.org; Mon, 12 Nov 2007 15:13:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Irfed-0002ba-Bz for emacs-devel@gnu.org; Mon, 12 Nov 2007 15:13:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Irfeb-0002Z9-OU for emacs-devel@gnu.org; Mon, 12 Nov 2007 15:13:07 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Irfeb-0002Yp-BA for emacs-devel@gnu.org; Mon, 12 Nov 2007 15:13:05 -0500 Original-Received: from mail-in-09.arcor-online.net ([151.189.21.49]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Irfea-0001gW-UP for emacs-devel@gnu.org; Mon, 12 Nov 2007 15:13:05 -0500 Original-Received: from mail-in-11-z2.arcor-online.net (mail-in-11-z2.arcor-online.net [151.189.8.28]) by mail-in-09.arcor-online.net (Postfix) with ESMTP id 53512302ACE; Mon, 12 Nov 2007 21:13:03 +0100 (CET) Original-Received: from mail-in-13.arcor-online.net (mail-in-13.arcor-online.net [151.189.21.53]) by mail-in-11-z2.arcor-online.net (Postfix) with ESMTP id 1D2FF345C03; Mon, 12 Nov 2007 21:13:03 +0100 (CET) Original-Received: from lola.goethe.zz (dslb-084-061-074-234.pools.arcor-ip.net [84.61.74.234]) by mail-in-13.arcor-online.net (Postfix) with ESMTP id C11DE25D2FB; Mon, 12 Nov 2007 21:13:02 +0100 (CET) Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 1E7681C12F67; Mon, 12 Nov 2007 21:12:57 +0100 (CET) In-Reply-To: <18231.43165.842097.720674@tfkp07.physik.uni-erlangen.de> (Roland Winkler's message of "Mon, 12 Nov 2007 02:13:01 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-Virus-Scanned: ClamAV 0.91.2/4757/Mon Nov 12 18:20:27 2007 on mail-in-13.arcor-online.net X-Virus-Status: Clean 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:83077 Archived-At: "Roland Winkler" writes: > 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. atomic-change-group is a Lisp macro in `subr.el'. (atomic-change-group &rest BODY) Perform BODY as an atomic change group. This means that if BODY exits abnormally, all of its changes to the current buffer are undone. This works regardless of whether undo is enabled in the buffer. This mechanism is transparent to ordinary use of undo; if undo is enabled in the buffer and BODY succeeds, the user can undo the change normally. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum