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: disabling undo boundaries Date: Sun, 10 May 2015 21:42:51 -0400 Message-ID: References: <87fv746rd5.fsf@newcastle.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1431308589 11423 80.91.229.3 (11 May 2015 01:43:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 May 2015 01:43:09 +0000 (UTC) Cc: Emacs-Devel devel To: phillip.lord@newcastle.ac.uk (Phillip Lord) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 11 03:43:00 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YrckG-00071N-G1 for ged-emacs-devel@m.gmane.org; Mon, 11 May 2015 03:43:00 +0200 Original-Received: from localhost ([::1]:35167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrckF-0006i5-Ll for ged-emacs-devel@m.gmane.org; Sun, 10 May 2015 21:42:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrckC-0006hy-8n for emacs-devel@gnu.org; Sun, 10 May 2015 21:42:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yrck9-0005aD-25 for emacs-devel@gnu.org; Sun, 10 May 2015 21:42:56 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:21785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrck8-0005a9-UK for emacs-devel@gnu.org; Sun, 10 May 2015 21:42:52 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRFpYts/2dsb2JhbAA3DoFFoW+BCIF1AQEEAVYjBQsLNBIUGA2IN6IRjHADgz4DA4NtBKNjhAVT X-IPAS-Result: AgUFAGvvdVRFpYts/2dsb2JhbAA3DoFFoW+BCIF1AQEEAVYjBQsLNBIUGA2IN6IRjHADgz4DA4NtBKNjhAVT X-IronPort-AV: E=Sophos;i="5.11,557,1422939600"; d="scan'208";a="119099100" Original-Received: from 69-165-139-108.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.165.139.108]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 May 2015 21:42:53 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id BFC39AE36F; Sun, 10 May 2015 21:42:51 -0400 (EDT) In-Reply-To: <87fv746rd5.fsf@newcastle.ac.uk> (Phillip Lord's message of "Sun, 10 May 2015 22:43:18 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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 Xref: news.gmane.org gmane.emacs.devel:186390 Archived-At: > I am wondering why the "nil" undo-boundaries get inserted when I change > *a different* buffer. This does not really make sense to me, and is > causing breakage in my package. The 3 separate undo entries you're seeing are actually the "normal" outcome (one undo-boundary per buffer-modifying command). self-insert-command has special ad-hoc code to try and merge sequences of single-char insertions by removing the previous undo-boundary. Which is why you normally only see a single undo entry. In your second case, I suspect that this ad-hoc code doesn't get to do what it's intended to do, because it does not recognize the undo-boundary that is candidate for removal as being "an undo-boundary we've auto-inserted". So, self-insert-command thinks that this undo-boundary may have been inserted by an explicit call to `undo-boundary' at the end of the previous command, in which case it should not be removed. The relevant code is in the remove_excessive_undo_boundaries function, in src/cmds.c. Stefan