all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: phillip.lord@russet.org.uk (Phillip Lord)
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change c7a6601 1/5: undo-size can count number of boundaries.
Date: Tue, 22 Sep 2015 22:41:37 +0100	[thread overview]
Message-ID: <874mim6sj2.fsf@russet.org.uk> (raw)
In-Reply-To: <jwvr3lqk4by.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Tue, 22 Sep 2015 08:49:16 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> and do it right before we add something to the undo-list (so the test of
>>> undo_list indeed tells us if this is the first new change pushed since
>>> the last boundary).  It should give us the same behavior but without the
>>> need for that variable.
>> Because, that triggers the hook only after a boundary.  With
>> "undo-buffer-undoably-changed", the hook is triggered after
>> undo-buffer-undoably-changed is set to nil which may or may not relate
>> to the addition of a boundary. And actually, currently it doesn't.
>
> So the question becomes: why doesn't it?


Okay. So, I'll recap, and then explain the logic that I am trying to
implement.

I've removed the behaviour from undo.c which calls undo-boundary in a
buffer whenever a change has happened in any other buffer because it
breaks my use case (and others using post-command-hook).

This removes a default which ensures that an undo-boundary were inserted
in long-running processes periodically, so avoiding the
"undo-outer-limit" situation which largely happens in buggy situations
(or when a user has done something really big).

So, the logic I am trying to implement (or think I have!) is:

- record all buffers which have had undo-able changes in them as we go

- every ten seconds check the size of the undo list, and iff it is
  bigger than undo-limit, and has less than 2 boundaries, add one at the
  start.

We need 2 boundaries because the undo-list compact always leaves upto
the first boundary.

In reality, I have made two optimisations which make life slightly more
complex.

- The timer actually runs 10 seconds only after the first undoable
  change in any buffer, since the last time we checked (i.e. it will run
  once in an idle emacs).

- I have not added a "undoable-change-hook" into lisp space because it
  will get called a lot. Rather, we have "first-undoable-change" which
  is called only if "undo-buffer-undoably-changed" is nil. The timer
  resets the buffer-local values of this to nil when it runs.

I've pushed some more changes and will test further tomorrow. It's
starting to behave as I expected now (my C was broken amoung other
things -- initializing local variables! What's that all about?).

I need to rename "undo-buffer-undoably-changed" to "-recently-changed" I
think.

Just to repeat everything that others have said, your patience and
kindness at dealing with dumb questions is rather humbling. Good luck to
you!

Phil







  reply	other threads:[~2015-09-22 21:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150915152129.671.61929@vcs.savannah.gnu.org>
     [not found] ` <E1Zbs2z-0000By-Qe@vcs.savannah.gnu.org>
2015-09-15 16:57   ` [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change c7a6601 1/5: undo-size can count number of boundaries Stefan Monnier
2015-09-17  8:08     ` Phillip Lord
2015-09-17 12:53       ` Stefan Monnier
2015-09-17 15:04         ` Phillip Lord
2015-09-18 20:26           ` Stefan Monnier
2015-09-22 10:45             ` Phillip Lord
2015-09-22 12:49               ` Stefan Monnier
2015-09-22 21:41                 ` Phillip Lord [this message]
2015-09-23  1:23                   ` Stefan Monnier
2015-09-23  8:39                     ` Phillip Lord
2015-09-23 13:44                       ` Stefan Monnier
2015-09-28 19:37                         ` Phillip Lord

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

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

  git send-email \
    --in-reply-to=874mim6sj2.fsf@russet.org.uk \
    --to=phillip.lord@russet.org.uk \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.