all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: phillip.lord@russet.org.uk (Phillip Lord)
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change e5ff575 2/2: Add a timer to ensure undo-boundaries in buffers.
Date: Sun, 06 Sep 2015 19:03:38 -0400	[thread overview]
Message-ID: <jwvd1xvmak5.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <87a8t6jbuy.fsf@russet.org.uk> (Phillip Lord's message of "Tue, 01 Sep 2015 18:19:49 +0100")

> Iff I do this, I would like to keep into elisp as much as possible.

Yes, that's generally what we try to do.

> I guess adding undo-pre-extend and undo-post-extend hooks should do the
> trick?

Not sure.  There's also the desire to keep costs down.  Adding undo
elements can happen *very often* in some cases (for some commands which
perform many changes), so the case of adding an undo record in a buffer
that already has had other undo records added since the last undo
boundary should be fast and I'd rather not run undo-pre-extend and
undo-post-extend hooks in that case.

So I think we should have a hook run whenever we push the first change
after a boundary.  That would let you (from Elisp) add the buffer to
some set of "modified" buffers, start timers, etc...

> Then anyone could switch this behaviour off. Then undo-outer-limit would
> become the final backstop.

Sounds good.

> Two issues. simple.el does not depend on timer, so I am not clear where
> to add this.

I think you can add it to simple.el for a first attempt (timer.el is
preloaded anyway).  Bootstrap is always slightly delicate, and it's
difficult to guess in advance what problems will show up and how to best
fix them.  So just assume the gods will be with you for now, and if they
don't show up, we'll see what needs to be done.

> And, I am aware that `buffer-undo-list' is just a list.  Anyone can
> change it anywhere in lisp, which would make the hooks difficult
> to enforce.

It's a problem in theory, indeed, but in practice it should be mostly
a non-issue.  IOW, I wouldn't worry about it.

> Just to clarify, you are suggesting a post-command add undo-boundary,
> rather than post-change (i.e. potentially many times per command)? I
> would need to think on this.

I'm not suggesting it: that's what the code does currently (look for
Fundo_boundary in src/keyboard.c).


        Stefan



  reply	other threads:[~2015-09-06 23:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150821093606.11577.60349@vcs.savannah.gnu.org>
     [not found] ` <E1ZSik4-000326-4S@vcs.savannah.gnu.org>
2015-08-30  3:30   ` [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change e5ff575 2/2: Add a timer to ensure undo-boundaries in buffers Stefan Monnier
2015-09-01 12:24     ` Phillip Lord
2015-09-01 16:16       ` Stefan Monnier
2015-09-01 17:19         ` Phillip Lord
2015-09-06 23:03           ` Stefan Monnier [this message]
2015-09-14 14:41             ` RFM: How to make a buffer-local var in C layer Phillip Lord
2015-09-15  1:48               ` Stefan Monnier
2015-09-15 12:08                 ` Phillip Lord
2015-09-15 14:18                   ` Stefan Monnier
2015-09-15 14:20                   ` Stefan Monnier
2015-09-15 15:27                     ` 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=jwvd1xvmak5.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=phillip.lord@russet.org.uk \
    /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.