From mboxrd@z Thu Jan  1 00:00:00 1970
From: stardiviner <numbchild@gmail.com>
Subject: Re: refile captured to all opened Org buffer files as targets
Date: Fri, 27 Dec 2019 09:17:41 +0800
Message-ID: <87sgl6a7nu.fsf@gmail.com>
References: <87sgl8v9sp.fsf@gmail.com>
Reply-To: numbchild@gmail.com
Mime-Version: 1.0
Content-Type: text/plain
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([2001:470:142:3::10]:36097)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <numbchild@gmail.com>) id 1ikeGE-0005LK-Fi
 for emacs-orgmode@gnu.org; Thu, 26 Dec 2019 20:17:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <numbchild@gmail.com>) id 1ikeGD-0001NR-9X
 for emacs-orgmode@gnu.org; Thu, 26 Dec 2019 20:17:50 -0500
Received: from [183.246.146.61] (port=2709 helo=dark.localdomain)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <numbchild@gmail.com>) id 1ikeGC-0001MY-R5
 for emacs-orgmode@gnu.org; Thu, 26 Dec 2019 20:17:49 -0500
In-reply-to: <87sgl8v9sp.fsf@gmail.com>
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: "Emacs-orgmode"
 <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
To: Org Mode <emacs-orgmode@gnu.org>


I improved command to get ride of =f.el= library function:

#+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 ; filter Org buffers
           (lambda (buffer)
             (if-let (file (buffer-file-name buffer))
                 (string-equal (file-name-extension file) "org")
               ;; (f-ext? file "org")
               ))
           (buffer-list))))
#+end_src

Here is the configured option:

#+begin_src emacs-lisp
(setq org-refile-targets '((nil :maxlevel . 3) ; current buffer headlines
                           (org-agenda-files :maxlevel . 2) ; agenda files headlines
                           (org-refile-targets-all-files :maxlevel . 3) ; all opened Org buffer files headlines
                           ))
#+end_src

I think this can be an option for user who might think this is useful like in my
situation. (I want to refile capture elfeed RSS entry to one of my opened Org
buffer's specific headline.)

-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3