From: Carsten Dominik <email@example.com> To: Oleksandr Gavenko <firstname.lastname@example.org> Cc: email@example.com Subject: Re: Kill all items with specific tag to kill-ring. Date: Thu, 25 Apr 2013 10:36:44 +0200 [thread overview] Message-ID: <F6C96DDA-1E67-4805-B785-A6EDC559C7A0@gmail.com> (raw) In-Reply-To: <loom.20130425T101814firstname.lastname@example.org> On 25.4.2013, at 10:21, Oleksandr Gavenko <email@example.com> wrote: > Carsten Dominik <carsten.dominik <at> gmail.com> writes: > >> >> On 25.4.2013, at 07:32, Oleksandr Gavenko <gavenkoa <at> gmail.com> wrote: >> >>> I use tags only on top level items in org-file. >>> >>> And want move all items marked by specific tag to different org-file. >>> >>> I expect that this command kill items with selected tag to kill-ring in one >>> step (so single undo command return original buffer content). >>> >>> Seems there are no such command build-in command... >> >> no, but you could easily make one using the function org-map-entries. >> > > I finish with very hackie code (based on knowledge of internal > implementation of org-scan-tags): > > (defun my-org-kill-by-tag (tag) > (interactive (list (read-input "Enter tag: "))) > (kill-new "") > (org-scan-tags > (lambda () > (let ( (last-command 'kill-region) ) > (org-cut-subtree))) > '(member tag tags-list) > nil) ) > > You can replace 'org-cut-subtree' by 'org-copy-subtree' if don't want remove > org entries... Yes, this work, nice trick with binding last-command to kill-region. A less hackie version would probably add the found entries to a string or list and only put that string into the kill ring at the end. org-map-entries would allow processing of several files in one go, but it would be a very similar implementation. - Carsten
next prev parent reply other threads:[~2013-04-25 8:36 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-04-25 5:32 Oleksandr Gavenko 2013-04-25 6:37 ` Carsten Dominik 2013-04-25 8:21 ` Oleksandr Gavenko 2013-04-25 8:36 ` Carsten Dominik [this message] 2013-04-25 8:56 ` Oleksandr Gavenko 2013-04-25 10:49 ` Carsten Dominik 2013-04-25 11:06 ` Oleksandr Gavenko 2013-04-25 11:48 ` Bernt Hansen 2013-04-29 17:14 ` Oleksandr Gavenko 2013-05-01 20:51 ` Carsten Dominik
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.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=F6C96DDA-1E67-4805-B785-A6EDC559C7A0@gmail.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: Kill all items with specific tag to kill-ring.' \ /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
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.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).