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: An idea: combine-change-calls Date: Tue, 27 Mar 2018 16:58:16 +0000 Message-ID: <20180327165816.GB4105@ACM> References: <20180324135024.GA6319@ACM> <20180325191424.GE6292@ACM> <20180326201728.GA28620@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1522170955 22548 195.159.176.226 (27 Mar 2018 17:15:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Mar 2018 17:15:55 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 27 19:15:51 2018 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 1f0sCN-0005k4-0y for ged-emacs-devel@m.gmane.org; Tue, 27 Mar 2018 19:15:51 +0200 Original-Received: from localhost ([::1]:35378 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0sEQ-0006mQ-D2 for ged-emacs-devel@m.gmane.org; Tue, 27 Mar 2018 13:17:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0sEG-0006m1-Mi for emacs-devel@gnu.org; Tue, 27 Mar 2018 13:17:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0sED-0002ep-4l for emacs-devel@gnu.org; Tue, 27 Mar 2018 13:17:48 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:14220 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1f0sEC-0002ea-Ta for emacs-devel@gnu.org; Tue, 27 Mar 2018 13:17:45 -0400 Original-Received: (qmail 47461 invoked by uid 3782); 27 Mar 2018 17:17:43 -0000 Original-Received: from acm.muc.de (p5B14757F.dip0.t-ipconnect.de [91.20.117.127]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 27 Mar 2018 19:17:42 +0200 Original-Received: (qmail 5244 invoked by uid 1000); 27 Mar 2018 16:58:16 -0000 Content-Disposition: inline In-Reply-To: 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 [fuzzy] X-Received-From: 193.149.48.1 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:224101 Archived-At: Hello, Stefan. On Mon, Mar 26, 2018 at 17:07:40 -0400, Stefan Monnier wrote: > > I'm experimenting with a different strategy: surrounding the mass of > > elements in buffer-undo-list with a `(combine-change-begin ,beg ,end) > > and a `(combine-change-end ,beg ,end). > Beware: this changes the format of entries that can appear in the > buffer-undo-list, which has repercussions beyond primitive-undo, IOW it > can/will break other things such as undo-in-region and undo-tree. Thanks. I didn't know about undo-in-region. That is a peculiarly badly documented feature: Neither manual states what it means for an undo-entry to be "within the region", and nowhere is it stated what happens to undo-entries which aren't in the region. Maybe they are just discarded, maybe they are somehow kept in the undo list. It looks like I've got some source code to read. By the way, what's undo-tree? I've not been able to find that symbol at all in the source code. > Better use the (apply DELTA BEG END FUN-NAME . ARGS) form, which was > introduced specifically for use of such extensions. This won't work, at least not without some seriously twisted coding: The essential thing about (combine-change-end/begin ..) is that they bind inhibit-modification-hooks to non-nil for other entries in the undo-list. Maybe FUN-NAME could call primitive-undo, but this doesn't seem wise. > Stefan -- Alan Mackenzie (Nuremberg, Germany).