From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Scary undo Date: Tue, 06 May 2008 19:36:42 +0200 Message-ID: <4820972A.1030705@gmail.com> References: <48202D32.4020705@gmail.com> <86abj3zqjw.fsf@lola.quinscape.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1210095459 10026 80.91.229.12 (6 May 2008 17:37:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 May 2008 17:37:39 +0000 (UTC) Cc: Emacs Devel To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 06 19:38:14 2008 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 1JtR6s-0006Re-EH for ged-emacs-devel@m.gmane.org; Tue, 06 May 2008 19:37:50 +0200 Original-Received: from localhost ([127.0.0.1]:53719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JtR6A-00077p-IM for ged-emacs-devel@m.gmane.org; Tue, 06 May 2008 13:37:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JtR64-00075t-Uo for emacs-devel@gnu.org; Tue, 06 May 2008 13:37:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JtR5z-000730-AH for emacs-devel@gnu.org; Tue, 06 May 2008 13:36:58 -0400 Original-Received: from [199.232.76.173] (port=35799 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JtR5z-00072r-1E for emacs-devel@gnu.org; Tue, 06 May 2008 13:36:55 -0400 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JtR5s-0006eB-GA; Tue, 06 May 2008 13:36:48 -0400 Original-Received: from c83-254-150-27.bredband.comhem.se ([83.254.150.27]:60507 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1JtR5q-0004Xg-64; Tue, 06 May 2008 19:36:47 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: <86abj3zqjw.fsf@lola.quinscape.zz> X-Antivirus: avast! (VPS 080505-0, 2008-05-05), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.150.27 X-Scan-Result: No virus found in message 1JtR5q-0004Xg-64. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1JtR5q-0004Xg-64 fd997c314b16985368bcbafe54e47914 X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) 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:96603 Archived-At: David Kastrup wrote: > "Lennart Borgman (gmail)" writes: > >> I would like to undo a change made by a function that I call with >> funcall. I do not know exactly what the function does, but hopefully >> it will only indent the current line. However the new indentation >> might be wrong. >> >> The scenario is something like this >> >> (funcall the-indentation-function) >> (when (= 0 (current-indentation)) >> ;; undo what `the-indentation-function' did, >> ;; but how? >> ) >> >> I am a bit scared of writing this undo part so if someone could help >> me I would be glad. I do not think I can use `undo-boundary' here. > > I'd be tempted to do something like > > (condition-case nil > (atomic-change-group > (funcall the-indentation-function) > (when (=0 (current-indentation)) > (signal 'barfout nil))) > (barfout)) Thanks David and Juanma, that was what I needed.