From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Unbalanced change hooks (part 2) Date: Mon, 1 Aug 2016 17:15:52 +0000 Message-ID: <20160801171552.GC15055@acm.fritz.box> References: <20160731121642.GB2205@acm.fritz.box> <83a8gxq288.fsf@gnu.org> <20160731172804.GD2205@acm.fritz.box> <834m75ptij.fsf@gnu.org> <20160731212635.GF2205@acm.fritz.box> <83shuoocwp.fsf@gnu.org> <20160801165323.GB15055@acm.fritz.box> NNTP-Posting-Host: blaine Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1470071845 29875 195.159.176.226 (1 Aug 2016 17:17:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 1 Aug 2016 17:17:25 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: ofv@wanadoo.es, rcopley@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 01 19:17:22 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUGq9-0007ak-9D for ged-emacs-devel@m.gmane.org; Mon, 01 Aug 2016 19:17:21 +0200 Original-Received: from localhost ([::1]:51928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUGq5-0000BQ-Qm for ged-emacs-devel@m.gmane.org; Mon, 01 Aug 2016 13:17:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUGpU-0000BD-Fs for emacs-devel@gnu.org; Mon, 01 Aug 2016 13:16:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUGpP-00077Q-31 for emacs-devel@gnu.org; Mon, 01 Aug 2016 13:16:39 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:26647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUGpO-000778-Ow for emacs-devel@gnu.org; Mon, 01 Aug 2016 13:16:35 -0400 Original-Received: (qmail 91034 invoked by uid 3782); 1 Aug 2016 17:16:32 -0000 Original-Received: from acm.muc.de (p548C70EF.dip0.t-ipconnect.de [84.140.112.239]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 01 Aug 2016 19:16:30 +0200 Original-Received: (qmail 15431 invoked by uid 1000); 1 Aug 2016 17:15:52 -0000 Content-Disposition: inline In-Reply-To: <20160801165323.GB15055@acm.fritz.box> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206320 Archived-At: Hello again, Eli. On Mon, Aug 01, 2016 at 04:53:23PM +0000, Alan Mackenzie wrote: [ .... ] > Please provide some means by which CC Mode has access to the full details > of a buffer change. That's all I'm asking for now (even if I'm getting a > bit repetitive). How about the following idea: we create a special purpose undo list separate from the existing one. Every change is recorded on this list, regardless of whether or not main undo is disabled. After each invocation of after-change-functions the list is emptied. (defmacro with-change-undone (&rest forms) ...) An after-change-function can invoke the macro `with-change-undone' which would undo the changes, execute the &rest forms, then redo the changes. Surely this would satisfy both of us, no? -- Alan Mackenzie (Nuremberg, Germany).