all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Campbell Barton <ideasman42@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Support for undo-amalgamate in a version of the atomic-change-group macro (with patch)
Date: Mon, 01 Nov 2021 13:43:37 -0400	[thread overview]
Message-ID: <jwvzgqnss0m.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAEcf3NwgG2BY_0m2ui7WtiDgcVx68CX0REv4MUSQDRQXohF6qA@mail.gmail.com> (Campbell Barton's message of "Fri, 29 Oct 2021 12:48:24 +1100")

> Hi, there have been a handful of times I've needed to treat multiple
> actions as a single action,
> others too (see stackoverflow question [0]).
>
> While this is supported using change groups, the resulting macro ends
> up being nearly identical to the existing `atomic-change-group' macro.
> The only difference is a call to undo-amalgamate-change-group.

The other difference would be the call to `cancel-change-group` (you
may want to not undo the changes in case of errors).

> Attached a patch to add `atomic-change-group-undo-amalgamate' so
> packages don't need to use a modified copy of this macro.

I suspect that we'd be better off with a separate macro which only does
the amalgamation without the cancel-change-group-on-error.

But I wonder how often such a macro would be useful: undo boundaries are
normally added only by the command-loop (i.e. the loop which repeatedly
reads a key and calls the corresponding command), so unless your macro's
body calls `recursive-edit` it's very unlikely that you'll get any undo
entries that you would then want to remove.

(Re)reading your stackexchange question, it seems you want to amalgamate
undo entries from different commands.  So do you run those commands
within a `recursive-edit`?  If not, how do you manage to run those
commands from within your (new) macro?


        Stefan




  reply	other threads:[~2021-11-01 17:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29  1:48 Support for undo-amalgamate in a version of the atomic-change-group macro (with patch) Campbell Barton
2021-11-01 17:43 ` Stefan Monnier [this message]
2021-11-02  1:04   ` Campbell Barton
2021-11-02  2:14     ` Stefan Monnier
2021-11-02  2:14     ` Campbell Barton
2021-11-07  8:45       ` Campbell Barton
2021-11-07 13:21         ` Stefan Monnier
2021-11-07 23:09           ` Campbell Barton
2021-11-07 23:29             ` Campbell Barton
2021-11-08  4:39             ` Stefan Monnier
2021-11-08  4:46               ` Lars Ingebrigtsen
2021-11-08  5:41                 ` Campbell Barton
2021-11-08 13:40                   ` Stefan Monnier

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=jwvzgqnss0m.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=ideasman42@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 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.