emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org, Eric Schulte <schulte.eric@gmail.com>
Subject: Re: [bug] [babel] babel corrupts undo history
Date: Fri, 21 Mar 2014 15:42:49 -0700	[thread overview]
Message-ID: <CAJcAo8sFf7fxvyOyETb7UnsrfLNeHiw2ZA+RGM+hM62tWJ9sPA@mail.gmail.com> (raw)
In-Reply-To: <87r45vkxxm.fsf@bzg.ath.cx>

hi bastien,

On 3/21/14, Bastien <bzg@gnu.org> wrote:
>> buffer will be corrupted.
>
> Not for me.  This has surely to do with undo-tree.

in emacs 23, i get the same bug with built-in undo.

>> one thing org sometimes does is try to set buffer-undo-list.  it's
>> really for speed imo.  i can't think of any reason why org really
>> needs it.  perhaps i am mistaken and there is a really good reason for
>> such things, but i suspect it has caused a lot of bugs.
>
> I can safely say this is *never* for speeding things up, it's for
> preserving the undo list state.

no, you misunderstand.  there is no sufficiently good reason for org
code to ever set such an internal variable in any buffer that the user
edits to my knowledge.

the only reason that makes sense to me is to turn off undo by setting
it to t in buffers that the user does not edit [such as a hidden
buffer], so that you avoid possible overhead.  that /is/ a potential
speed issue, even if it is mediated by memory.

thus, in practice, the variable is only really best used for speed imo.

> Unless I misunderstand, the addition of indentation is not manually
> done, so it should not be part of the undo list.

you understand here i think, but we disagree.  at present org
manipulates an undo variable that should not be manipulated, and the
result at best is that the user does this:

  c-c '
  edit
  c-c '
  edit
  undo
  undo OOPS the source edit is skipped over what just happened?
  c-c '
  undo OOPS the undo changes are all gone where did they go?

and at worst there is buffer corruption.  so i would far prefer to
have the indentation adding be NOT specially worked around by changing
the undo variable.

it is much better to not skip an entire set of changes + no bugs than
"the user will never want to see the indentation adding so let's
pretend it doesn't exist".

it might be better to have no indentation by default, but that's another issue.

>> even when there is not a bug per se, when you edit a source block,
>> there is a gap in the undo record.  like nixon's tape gap during
>> watergate, it raises questions.  :/
>
> :)

principle of least surprise is key here.

>> to me, undo is a low-level feature that should never be buggy or
>> surprising.  if it is, then anything that causes those should be
>> ripped out, even if it means losing a fancy undo-related feature.
>
> Fully agreed.  Let's raise bugs in this area when you have time
> and when the bug can be isolated from other third-part package.

i haven't tried with -Q yet but i don't think it's an undo-tree bug.

i think fixing each bug as it comes up is more error-prone for the
future than stopping the changing of undo-tree-list.

in most cases, i think the undo list manipulation should never happen
in the first place.  it just causes too many problems.

samuel

  reply	other threads:[~2014-03-21 22:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28  1:13 [bug] [babel] babel corrupts undo history Samuel Wales
2013-08-28 14:42 ` Eric Schulte
2013-08-28 16:03   ` Aaron Ecay
2013-08-28 18:52     ` Eric Schulte
2013-08-28 19:41       ` Samuel Wales
2013-08-28 19:43         ` Samuel Wales
2013-08-28 19:51           ` Samuel Wales
2013-10-28 19:17             ` Aaron Ecay
2013-10-28 19:45               ` Samuel Wales
2013-10-28 20:07                 ` Aaron Ecay
2013-10-28 21:26                   ` Samuel Wales
2014-03-10  2:46                     ` Samuel Wales
2014-03-18 20:48                       ` Bastien
2014-03-21 21:34                         ` Samuel Wales
2014-03-21 22:07                           ` Bastien
2014-03-21 22:42                             ` Samuel Wales [this message]
2014-03-21 22:45                               ` Samuel Wales
2014-03-21 23:40                               ` Bastien
2014-03-22  0:11                                 ` Samuel Wales
2014-03-22  0:18                                   ` Bastien
2014-03-22  0:37                                     ` Samuel Wales
2014-03-22  0:44                                       ` Samuel Wales
2014-03-22  8:43                                         ` Bastien
2014-03-22  8:57                                           ` Samuel Wales
2013-08-28 17:08   ` Samuel Wales
2013-08-28 17:18     ` Samuel Wales

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJcAo8sFf7fxvyOyETb7UnsrfLNeHiw2ZA+RGM+hM62tWJ9sPA@mail.gmail.com \
    --to=samologist@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).