emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mikhail Skorzhinskii <mskorzhinskiy@eml.cc>
To: John Sturdy <jcg.sturdy@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Exporting agendas as org-mode files?
Date: Wed, 13 Nov 2019 12:07:33 +0100	[thread overview]
Message-ID: <87a790uj9m.fsf@eml.cc> (raw)
In-Reply-To: <8736esv69z.fsf@alphapapa.net>

Adam Porter <adam@alphapapa.net> writes:

 > org-ql would make this pretty easy, I think.  Use an org-ql query to
 > select entries, and for the :action function, use a simple function that
 > copies the entry or subtree and yanks it into a buffer.  Then save that
 > buffer to a file.

Yes, it is.

Although just picking some entries from huge org-mode base and write
them into separate file is a base feature of org-mode itself. org-ql
package just making the process of finding entries of interest much
easier and faster.

John Sturdy <jcg.sturdy@gmail.com> writes:

  > I'd like to be able to export agendas as org-mode files

If you're looking into the pure org-mode approach, then what you're
looking for ~org-agenda-write~ function or custom agenda view written
with exporting in mind. In order to export to org all you need to do is
to specify .org extension.


I was using this small snippet to export some of my agenda seacrhes:

#+begin_src emacs-lisp
  (org-agenda nil "a")
  (org-agenda-write "~/example.org" nil t "*Org Agenda*")

Be aware that this will regenerate your *Org Agenda* buffer, so either
use sticky agendas or export agendas in separate emacs process.

But I would highly recommend using org-ql for these purpouses. Besides
pretty solid and easy-to-use interface it is noticably faster.

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

#+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))))
      (find-file file)
      (org-edit-headline heading))))

(defun org-user/export-info ()
  "Export all information entries into one file."
  (find-file "~/org/cals/info.org")
  (insert "#+TITLE: Information")
    '(tags-local "info")
    :action #'org-user/store-info)

You need to invoke (org-user/export-info), obviosuly.

  reply	other threads:[~2019-11-13 11:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 15:46 John Sturdy
2019-11-13  2:50 ` Adam Porter
2019-11-13 11:07   ` Mikhail Skorzhinskii [this message]
2019-11-14 12:03     ` Adam Porter
2019-11-18 12:11     ` John Sturdy

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:

  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=87a790uj9m.fsf@eml.cc \
    --to=mskorzhinskiy@eml.cc \
    --cc=emacs-orgmode@gnu.org \
    --cc=jcg.sturdy@gmail.com \
    --subject='Re: Exporting agendas as org-mode files?' \


* 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:


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).