From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Atomic Macro Calls
Date: Mon, 3 May 2010 06:07:59 -0700 (PDT) [thread overview]
Message-ID: <55484925-0837-4f50-b236-dccd96797c6e@d19g2000yqf.googlegroups.com> (raw)
Hey!
I think "the security" of macro calls in Emacs would be improved if
we, upon error during execution, queried the user for complete revert/
undo of all the effects that were made in buffers affected by this
last macro call. For the case when only a single buffer is changed the
following function could serve as a first mockup for a suitable
wrapper function that solves this problem.
(defun kmacro-call-macro-atomic (arg)
"Call last keyboard macro.
If an error during execution ask user to revert any changes that
occurred."
(interactive "P")
(atomic-change-group
(kmacro-call-macro arg)))
Unfortunately atomic-change-group does not seem to work as expected
here.
It does not revert the buffer contents but instead the function cancel-
change-group errors with the message:
Undoing to some unrelated state
To compare with the following code changes the buffer contents only if
the search succeeds:
(atomic-change-group (insert "x") (search-forward ";; "))
Does anybody have a better implementation of the function kmacro-call-
macro-atomic that undoes the changes made during the macro-call?
Thanks in advance for all kinds of feedback,
Per Nordlöw
next reply other threads:[~2010-05-03 13:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-03 13:07 Nordlöw [this message]
2010-05-03 19:48 ` Atomic Macro Calls Andreas Politz
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=55484925-0837-4f50-b236-dccd96797c6e@d19g2000yqf.googlegroups.com \
--to=per.nordlow@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.