* Want to delete distinct regions but make capable undo by single command.
@ 2013-04-25 5:27 Oleksandr Gavenko
2013-04-25 11:13 ` Oleksandr Gavenko
0 siblings, 1 reply; 3+ messages in thread
From: Oleksandr Gavenko @ 2013-04-25 5:27 UTC (permalink / raw)
To: help-gnu-emacs
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.
--
Best regards!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Want to delete distinct regions but make capable undo by single command.
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
0 siblings, 0 replies; 3+ messages in thread
From: Oleksandr Gavenko @ 2013-04-25 11:13 UTC (permalink / raw)
To: help-gnu-emacs
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...
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <mailman.24601.1366867653.855.help-gnu-emacs@gnu.org>]
end of thread, other threads:[~2013-04-25 11:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[not found] <mailman.24601.1366867653.855.help-gnu-emacs@gnu.org>
2013-04-25 6:01 ` Rami A
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).