From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change f59d1be: Move undo amalgamation to lisp. Date: Thu, 08 Oct 2015 16:53:59 -0400 Message-ID: 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 1444337951 8289 80.91.229.3 (8 Oct 2015 20:59:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Oct 2015 20:59:11 +0000 (UTC) Cc: emacs-devel@gnu.org To: phillip.lord@russet.org.uk (Phillip Lord) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 08 22:58:58 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 1ZkIH9-00014c-Bh for ged-emacs-devel@m.gmane.org; Thu, 08 Oct 2015 22:58:55 +0200 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkIGk-0007yt-CX for ged-emacs-devel@m.gmane.org; Thu, 08 Oct 2015 16:58:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:41856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkIGk-0007xk-34 for ged-emacs-devel@m.gmane.org; Thu, 08 Oct 2015 16:58:30 -0400 Original-Received: from localhost ([::1]:37008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkIGj-0007OF-NH for ged-emacs-devel@m.gmane.org; Thu, 08 Oct 2015 16:58:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkIDJ-0006Jt-3O for emacs-devel@gnu.org; Thu, 08 Oct 2015 16:54:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkIDF-0002Vs-3d for emacs-devel@gnu.org; Thu, 08 Oct 2015 16:54:57 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:44624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkIDE-0002Vc-C0 for emacs-devel@gnu.org; Thu, 08 Oct 2015 16:54:53 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 890AB8612D; Thu, 8 Oct 2015 16:54:27 -0400 (EDT) Original-Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id C5D6E1E5B8D; Thu, 8 Oct 2015 16:53:59 -0400 (EDT) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 9569DB43A9; Thu, 8 Oct 2015 16:53:59 -0400 (EDT) In-Reply-To: <878u7djfs2.fsf@russet.org.uk> (Phillip Lord's message of "Thu, 08 Oct 2015 20:56:13 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.71, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TRANSFR 0.11, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca 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:191070 Archived-At: > 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. >> 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, ...). Stefan