From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [bug] [babel] babel corrupts undo history Date: Wed, 28 Aug 2013 12:52:51 -0600 Message-ID: <87bo4h8x63.fsf@gmail.com> References: <87d2oxanct.fsf@gmail.com> <87hae9ajz2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEkrY-0008QZ-64 for emacs-orgmode@gnu.org; Wed, 28 Aug 2013 14:53:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEkrS-0000GR-SE for emacs-orgmode@gnu.org; Wed, 28 Aug 2013 14:53:04 -0400 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]:48639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEkrS-0000Fd-Kr for emacs-orgmode@gnu.org; Wed, 28 Aug 2013 14:52:58 -0400 Received: by mail-pa0-f45.google.com with SMTP id bg4so6596071pad.4 for ; Wed, 28 Aug 2013 11:52:57 -0700 (PDT) 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: Samuel Wales Cc: emacs-orgmode@gnu.org Aaron Ecay writes: > Hi Eric and Samuel, > > As I understand it, the problem is that the undo history gets scrambled > by the interleaving of user edits (in the indirect source-editing > buffer) and automatic changes introduced by org (un- and re-indenting > the source code). > > I have the following patch, which seems to prevent the misbehavior > Samuel noticed. It has the drawback of not keeping the fine-grained > undo information: after org-src-edit-exit, all changes made during the > edit are seen as only one change, and undone as a unit. > > I think the problem of interleaving the automatic and user-driven > changes in a sensible way is tricky. We don=E2=80=99t want the first inv= ocation > of undo after org-src-edit-exit to remove the contents of the code > block, which is what a naive approach gives (since org-src-edit-exit > deletes then reinserts the code block contents). > > I=E2=80=99ve been running with this patch for a while and not noticed any= ill > effects. But I haven=E2=80=99t made a concerted attempt to test undo aro= und > code blocks, which is why I=E2=80=99ve held off on pushing it. If it fix= es > Samuel=E2=80=99s problem and looks good, perhaps it is ready to go. > Aaron, thanks for this fix. Sam, does this patch fix your problem? If so then I think it should be applied. I didn't write and am not familiar with this code, so I'll leave application to someone more competent than myself. --=20 Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D