emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-orgmode@gnu.org
Subject: Re: refile captured to all opened Org buffer files as targets
Date: Fri, 27 Dec 2019 00:34:42 -0600	[thread overview]
Message-ID: <87h81me0ot.fsf@alphapapa.net> (raw)
In-Reply-To: 87sgl8v9sp.fsf@gmail.com

stardiviner <numbchild@gmail.com> writes:

> I recently created an org-capture template for elfeed, it is finished. Now I
> have an idea is to refile it to all currently opened Org buffer files. So I
> created an function for ~org-refile-targets~ variable.
>
> #+begin_src emacs-lisp
> (defun org-refile-targets-all-files ()
>   "Use all currently opened Org buffer files as org-refile targets."
>   (mapcar 'buffer-file-name
>           (seq-filter (lambda (buffer) (if-let (file (buffer-file-name buffer)) (f-ext? file "org"))) ; filter Org buffers
>                       (buffer-list))))
> #+end_src
>
>
> Then set ~org-refile-targets~ to use upper custom function
>
> #+begin_src emacs-lisp :eval no
> (setq org-refile-targets '((nil :maxlevel . 3) ; current buffer headlies
>                            (org-agenda-files :maxlevel . 2) ; agenda files headlines
>                            (org-refile-targets-all-files :maxlevel . 3) ; all opened Org buffer files headlines
>                            ))
> #+end_src
>
> Can I add this as a patch to Org Mode repository?

    org-buffer-list is a compiled Lisp function in ‘org.el’.

    (org-buffer-list &optional PREDICATE EXCLUDE-TMP)

    Return a list of Org buffers.
    PREDICATE can be ‘export’, ‘files’ or ‘agenda’.

    export   restrict the list to Export buffers.
    files    restrict the list to buffers visiting Org files.
    agenda   restrict the list to buffers visiting agenda files.

    If EXCLUDE-TMP is non-nil, ignore temporary buffers.

  parent reply	other threads:[~2019-12-27  6:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-25 13:01 refile captured to all opened Org buffer files as targets stardiviner
2019-12-25 15:40 ` Ihor Radchenko
2019-12-27  1:32   ` stardiviner
2019-12-27  7:54     ` Ihor Radchenko
2019-12-27  1:17 ` stardiviner
2019-12-27  6:34 ` Adam Porter [this message]
2019-12-27 14:10   ` stardiviner

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=87h81me0ot.fsf@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-orgmode@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 public 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).