From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toby Cubitt Subject: bug#11774: org-mode causes undo boundaries to be lost Date: Mon, 25 Jun 2012 13:35:29 +0200 Message-ID: <20120625113529.GA15913__9222.11708170853$1340636610$gmane$org@c3po.home> References: <20120624212755.GA14501@c3po.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sj7aW-0004OG-MW for emacs-orgmode@gnu.org; Mon, 25 Jun 2012 07:36:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sj7aR-0006Ka-V8 for emacs-orgmode@gnu.org; Mon, 25 Jun 2012 07:36:12 -0400 Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-Message-ID: Content-Disposition: inline In-Reply-To: <20120624215241.GA6205@c3po.home> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: 11774@debbugs.gnu.org On Sun, Jun 24, 2012 at 11:52:41PM +0200, Toby Cubitt wrote: > On Sun, Jun 24, 2012 at 11:39:08PM +0200, Bastien wrote: > > Hi Toby, > > > > Toby Cubitt writes: > > > > > For some unknown reason, org-mode is causing the undo boundary between > > > the (2 . 4) and (1 . 2) entries to be removed from `buffer-undo-list'. > > > > Can you try again with > > > > (setq org-self-insert-cluster-for-undo nil) > > > > and report? > > Yup, that fixes the problem. > > I don't fully understand the purpose of > `org-self-insert-cluster-for-undo', given that the Emacs command loop > already groups consecutive undo entries together, but presumably it > enables a more aggressive form of clustering. > [snip] > > I could try to work around this in undo-tree-mode, but it seems to me > that org-mode shouldn't be throwing away an undo boundary that comes > before an entry which definitely shouldn't be clustered with anything > (namely the undo-tree-canary symbol, which is meaningless to org-mode). I've now added a work-around for this in undo-tree-mode (currently only in git, but I'll push to ELPA once it's sufficiently tested). I'm still not entirely convinced that the boundary discarding logic in org-self-insert-command is correct. For example, if I do the following: 1. Type some text at some location in an org-mode buffer 2. Move to another location very far away (without invoking any commands other than point motion) 3. Type some more text then org-self-insert-cluster-for-undo collapses the undo changesets for these two changes into one. Undoing then reverts both sets of changes at once, even though those changes might be so far apart that they aren't both visible at the same time in the buffer. That seems very undesirable to me. But as I can work around it in undo-tree-mode, I'll leave it up to Bastien to decide whether or not this feature needs reworking in org-mode. Best, Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org