emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Pierre-Luc Gauthier <p.luc.gauthier@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Custom tag exportation - Agenda export?
Date: Wed, 11 Oct 2017 19:36:24 -0500	[thread overview]
Message-ID: <87a80xxkvr.fsf@fastmail.fm> (raw)
In-Reply-To: <CAPkan7deWFcnxVmGBfbdeFoOCyNn8R1+xnRJUTC0Tbvxr92vnw@mail.gmail.com> (Pierre-Luc Gauthier's message of "Mon, 9 Oct 2017 14:31:40 -0400")

Pierre-Luc Gauthier <p.luc.gauthier@gmail.com> writes:

> So my question is,
> How can I export this tag filtered agenda view to, say a pdf with
> LaTeX customizations and all that nice stuff.
> The goal would be to be able to leave the house with a beautifully
> typeset document containing all @Errands tagged headers *and* content?
>
> If I use org-agenda-write and write a PDF file, I get basically the
> same screen as my view, no content, just the headers and in a rather
> crude layout.
>
> I guess what I need (conceptually) is a way to get all headers having
> said tag (or being a child of) be compiled in a file. Then I know all
> the cool export stuff (e.g.: HTML, LaTeX, etc) will be accessible.
>

The function org-map-entries could help here. For instance...

--8<---------------cut here---------------start------------->8---
(org-map-entries
 '(concat (org-get-heading) "\n" (org-get-entry))
 "@Errands" 'agenda))
--8<---------------cut here---------------end--------------->8---

...will return a list of strings containing the heading and entry text
for all of your entries tagged "@Errands".

Then you could iterate through that list and insert each item as a top
level heading in a new org file. The following, for instance, will
extract all relevant headings and insert them in a temporary buffer
("/tmp/export.org"):

--8<---------------cut here---------------start------------->8---
(with-current-buffer (find-file-noselect "/tmp/export.org")
  (delete-region (point-min) (point-max))
  (insert "* ")
  (insert (mapconcat 'identity
                     (org-map-entries
                      '(concat (org-get-heading) "\n" (org-get-entry))
                      "@Errands" 'agenda)
                     "\n* "))
  (org-align-all-tags))
--8<---------------cut here---------------end--------------->8---

This could be further refined. E.g., you could extract specific heading
components with the function org-heading-components and then place them
directly in a LaTeX file.

Best,
Matt

      parent reply	other threads:[~2017-10-12  0:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 18:31 Custom tag exportation - Agenda export? Pierre-Luc Gauthier
2017-10-11 15:40 ` Pierre-Luc Gauthier
2017-10-12  0:36 ` Matt Lundin [this message]

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=87a80xxkvr.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=p.luc.gauthier@gmail.com \
    /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).