From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change f59d1be: Move undo amalgamation to lisp. Date: Fri, 09 Oct 2015 09:31:18 +0100 Message-ID: <874mi0zbmx.fsf@russet.org.uk> References: <20151005134118.10933.50859@vcs.savannah.gnu.org> <87h9m52sh8.fsf@russet.org.uk> <878u7djfs2.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1444448124 13466 80.91.229.3 (10 Oct 2015 03:35:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 Oct 2015 03:35:24 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 10 05:35:19 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from eggs.gnu.org ([208.118.235.92]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZkkwJ-0007dI-4B for ged-emacs-devel@m.gmane.org; Sat, 10 Oct 2015 05:35:19 +0200 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zka6t-0007bU-PU for ged-emacs-devel@m.gmane.org; Fri, 09 Oct 2015 12:02:37 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zka6t-0007Wx-0I for ged-emacs-devel@m.gmane.org; Fri, 09 Oct 2015 12:01:31 -0400 Original-Received: from localhost ([::1]:39546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zka6r-0001y3-QF for ged-emacs-devel@m.gmane.org; Fri, 09 Oct 2015 12:01:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkT5J-0001og-Ob for emacs-devel@gnu.org; Fri, 09 Oct 2015 04:31:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkT5F-0007a5-L9 for emacs-devel@gnu.org; Fri, 09 Oct 2015 04:31:25 -0400 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:55303) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkT5F-0007ZS-Fs for emacs-devel@gnu.org; Fri, 09 Oct 2015 04:31:21 -0400 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1ZkT5D-0001IP-FJ; Fri, 09 Oct 2015 09:31:19 +0100 Original-Received: from jangai.ncl.ac.uk ([10.66.67.223] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1ZkT5C-0007bi-Jy; Fri, 09 Oct 2015 09:31:18 +0100 In-Reply-To: (Stefan Monnier's message of "Thu, 8 Oct 2015 16:53:59 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 Xref: news.gmane.org gmane.emacs.devel:191087 Archived-At: Stefan Monnier writes: >> Set against this, of course, is that it also becomes harder to change >> from lisp. Does the > >> call2 (Qmy_function,arg1,arg2) > >> work like a normal lisp call? I mean, can I redefine my-function, and >> will it run the new definition? Is it still open to advice? > > Yes. Qmy_function is just the symbol, so the C code will call whichever > function is bound to this symbol, like a call from Lisp would do. Okay, no worries. >>> The current logic in remove_excessive_undo_boundaries is far from >>> perfect, but unless you have a really good idea how to do it >>> differently, I recommend you just try to reproduce it in Elisp. >> As I said, the difficulty comes about from trying to work out whether >> the last undo-boundary is an "automatic" one (i.e. added by the C layer >> and the command loop) or a "manual" one (i.e. added by a call to >> undo-boundary). > > You can solve it in the same way we do it no: save the auto-added boundary > in a variable (last_undo_boundary) when you add it, so you can > afterwards use an `eq' test to figure out if this boundary was > added automatically. > > Since you're moving the "auto-adding" to Lisp, last_undo_boundary will > naturally move to Lisp as well. > >> What I didn't like about this logic is that it only works for a single >> buffer; it assumes that there is only one last_undo_boundary. > > No: last_undo_boundary can be buffer-local. You can also make it > contain more info (e.g. add for example which was the command that > created the corresponding change, or which other buffers received > a boundary at the same, ...). Yes, that's true, once it's in lisp. Phil