From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: refile captured to all opened Org buffer files as targets Date: Fri, 27 Dec 2019 00:34:42 -0600 Message-ID: <87h81me0ot.fsf@alphapapa.net> References: <87sgl8v9sp.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52068) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikjDA-0005Tc-Nu for emacs-orgmode@gnu.org; Fri, 27 Dec 2019 01:35:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ikjD6-0001f1-L6 for emacs-orgmode@gnu.org; Fri, 27 Dec 2019 01:35:00 -0500 Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:52106 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ikjD6-0001eV-EJ for emacs-orgmode@gnu.org; Fri, 27 Dec 2019 01:34:56 -0500 Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1ikjD1-000oZ3-SP for emacs-orgmode@gnu.org; Fri, 27 Dec 2019 07:34:51 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org stardiviner 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.