From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: An idea: combine-change-calls
Date: Thu, 29 Mar 2018 17:11:01 +0000 [thread overview]
Message-ID: <20180329171101.GB5213@ACM> (raw)
In-Reply-To: <jwvzi2q7vms.fsf-monnier+emacs@gnu.org>
Hello, Stefan.
On Thu, Mar 29, 2018 at 11:40:26 -0400, Stefan Monnier wrote:
> > I don't think "consider" is the right word here. I don't think it will
> > work at all.
> I expect otherwise.
[ .... ]
> You keep assuming a shape like
> ...previous elements...
> (apply ....)
> ...undo-elements...
> (apply ....)
> ...subsequent elements...
> where I'm assuming a shape like:
> ...previous elements...
> (apply .... ...undo-elements...)
> ...subsequent elements...
I think you've just drawn two pictures of possible undo lists.
> I don't see any part of primitive-undo which would prevent it being used
> recursively in such a situation.
Right, I think I've got it now. The macro combine-change-calls would
maybe first push some sort of sentinal element onto buffer-undo-list,
then let ,@forms run, then massage the list so that the 2000 elements
created by ,@forms would become part of the `apply' element.
Yes, that would work. :-)
I will implement this.
> >> ... than I'd want this new extension to be generic rather than
> >> specific for this particular use-case.
> > It is generic, in the sense it handles any case where
> > before/after-change-functions are to be condensed into one call of each.
> > What do you mean by generic, here?
> That it can be used by other things than combine-change-calls.
> I.e. generic is the same sense as the (apply ....) thingy is generic.
I still don't understand. What other things could possibly be similiar
enough to collecting before/after-change-functions to be abstractable
into some sort of parameter? Could you give an example?
> > It does a good deal more than "optimizing the representation" - it makes
> > an irreversible change which loses information.
> To the extent that most execution of code makes irreversible changes,
> I agree, but other than that, I fail to see what information you're
> thinking about.
> > Somebody, sometime, is going to need that info.
> Could you give some hypothetical example to give me an idea of what kind
> of info you're thinking of and where/when it might be needed?
The information is the original undo entries created by the Emacs
primitives whilst in combine-change-calls.
As to where/when/why it might be needed, I couldn't say at this point.
Somebody, sometime, will want it for some reason, just like you said in
your piece about "hiding information" I quoted a short while ago.
Why are you so keen to destroy this detailed information? Its continued
existence does not cause any disadvantage. The run time which would be
saved in `undo' is minimal and inconsequential.
> >> Whatever you decide to do with the undo-log, handling undo-boundary
> >> pushed during the execution of `body` will be tricky I suspect (except
> >> if we just don't touch the undo-list, of course).
> > In my current code, the only undo-boundary pushed (in the handling of
> > combine-change-begin) is immediately acted upon to terminate the
> > recursive invocation of primitive-undo. This is pushed onto the LIST
> > variable in the nested p-u, and doesn't affect buffer-undo-list or
> > pending-undo-list.
> I'm referring to undo-boundaries pushed by the "execution of
> `body`", not by your code.
OK. We could amend primitive-undo such that the argument N could,
additionally, take the value t, meaning "undo all elements in the list,
ignoring nils". Or something like that.
> IIUC we agree that this is considered an unimportant use-case and it's
> OK to just ignore such boundaries.
I suppose so. What would such a boundary mean anyway? We're talking
about a scenario where all the change hook invocations are amalgamated.
How could it make sense to split that up?
> >> IIUC The code you cite only strips them from the undo elements added
> >> while performing an undo (i.e. from "redo" elements), so they should
> >> still work for a plain "edit .... undo".
> > Ah, is that it? I had some difficulty understanding it properly.
> Yes, that's it. I don't think it affects this discussion at all.
I suppose not. Not at the moment, anyway.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2018-03-29 17:11 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-24 13:50 An idea: combine-change-calls Alan Mackenzie
2018-03-24 22:18 ` Stefan Monnier
2018-03-25 19:14 ` Alan Mackenzie
2018-03-25 20:05 ` Stefan Monnier
2018-03-26 20:17 ` Alan Mackenzie
2018-03-26 21:07 ` Stefan Monnier
2018-03-27 16:58 ` Alan Mackenzie
2018-03-27 18:30 ` Stefan Monnier
2018-03-27 19:45 ` Alan Mackenzie
2018-03-27 20:24 ` Stefan Monnier
2018-03-28 20:42 ` Alan Mackenzie
2018-03-28 21:26 ` Stefan Monnier
2018-03-29 15:10 ` Alan Mackenzie
2018-03-29 15:40 ` Stefan Monnier
2018-03-29 17:11 ` Alan Mackenzie [this message]
2018-03-29 19:10 ` Stefan Monnier
2018-03-30 11:46 ` Alan Mackenzie
2018-03-30 15:05 ` Stefan Monnier
2018-03-31 21:00 ` Alan Mackenzie
2018-03-31 23:38 ` Stefan Monnier
2018-04-01 14:24 ` Alan Mackenzie
2018-04-01 19:22 ` Stefan Monnier
2018-03-30 9:12 ` Johan Bockgård
2018-03-30 13:04 ` Stefan Monnier
2018-04-02 16:25 ` Alan Mackenzie
2018-04-02 17:52 ` Johan Bockgård
2018-04-03 0:41 ` Stefan Monnier
2018-04-03 1:43 ` Clément Pit-Claudel
2018-04-03 3:15 ` Richard Stallman
2018-03-26 21:09 ` Stefan Monnier
2018-03-27 0:36 ` Stefan Monnier
2018-03-27 17:00 ` Alan Mackenzie
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180329171101.GB5213@ACM \
--to=acm@muc.de \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.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).