From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: Exporting agendas as org-mode files? Date: Thu, 14 Nov 2019 06:03:25 -0600 Message-ID: <87y2wiu0ky.fsf@alphapapa.net> References: <8736esv69z.fsf@alphapapa.net> <87a790uj9m.fsf@eml.cc> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:41490) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVDqk-0001kK-A6 for emacs-orgmode@gnu.org; Thu, 14 Nov 2019 07:03:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVDqf-0004qI-6s for emacs-orgmode@gnu.org; Thu, 14 Nov 2019 07:03:45 -0500 Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:59976 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iVDqf-0004o2-0D for emacs-orgmode@gnu.org; Thu, 14 Nov 2019 07:03:41 -0500 Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1iVDqb-000fOo-Rr for emacs-orgmode@gnu.org; Thu, 14 Nov 2019 13:03:37 +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 Mikhail Skorzhinskii writes: > Here is the snippet I am currently using to export all subtress directly > tagged with :info: to the separate file. (Sorry for the lack of proper > parametrisation). > > #+begin_src emacs-lisp > (defun org-user/store-info () > (let ((file "~/org/cals/info.org") > (heading (org-format-outline-path (org-get-outline-path t)))) > (save-excursion > (org-copy-subtree) > (find-file file) > (end-of-buffer) > (org-paste-subtree) > (org-edit-headline heading)))) > > (defun org-user/export-info () > "Export all information entries into one file." > (find-file "~/org/cals/info.org") > (erase-buffer) > (insert "#+TITLE: Information") > (org-ql-select > (org-agenda-files) > '(tags-local "info") > :action #'org-user/store-info) > (save-buffer)) > #+end_src Thanks, Mikhail, it's like you read my mind. :)