From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Want to delete distinct regions but make capable undo by single command.
Date: Thu, 25 Apr 2013 11:13:20 +0000 (UTC) [thread overview]
Message-ID: <loom.20130425T125000-802@post.gmane.org> (raw)
In-Reply-To: 87li87yybq.fsf@gavenkoa.example.com
Oleksandr Gavenko <gavenkoa <at> gmail.com> writes:
>
> Want to delete distinct regions but make capable undo by single command
> (programmatically).
>
> Like this happen after automatic replacement ('!'). You undo by 'M-_' all
> replacement at once instead sequentially each individually.
>
Wrote such code:
(defun my-org-kill-by-tag (tag)
"Put all entries that matches TAG from current org-file to `kill-ring'."
(interactive (list (completing-read "Enter tag: " (org-get-buffer-tags))))
(kill-new "")
(org-scan-tags
(lambda ()
(let ( (last-command 'kill-region) )
(org-cut-subtree)))
'(member tag tags-list)
nil) )
See origin:
http://thread.gmane.org/gmane.emacs.orgmode/71263
Kill all items with specific tag to kill-ring.
which exploit 'org-cut-subtree' implementation with:
(let ( (last-command 'kill-region) ) ...kill-commands...)
To make this possible your code MUST use only high-level kill ring
functions. Which take care on "last-command == kill-region".
If some function in code use 'kill-new' or 'kill-append' - 'last-command'
trick fail...
next prev parent reply other threads:[~2013-04-25 11:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-25 5:27 Want to delete distinct regions but make capable undo by single command Oleksandr Gavenko
2013-04-25 11:13 ` Oleksandr Gavenko [this message]
[not found] <mailman.24601.1366867653.855.help-gnu-emacs@gnu.org>
2013-04-25 6:01 ` Rami A
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=loom.20130425T125000-802@post.gmane.org \
--to=gavenkoa@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.
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).