From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Custom tag exportation - Agenda export? Date: Wed, 11 Oct 2017 19:36:24 -0500 Message-ID: <87a80xxkvr.fsf@fastmail.fm> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2RUF-0000dJ-LH for emacs-orgmode@gnu.org; Wed, 11 Oct 2017 20:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2RUB-0003WX-KP for emacs-orgmode@gnu.org; Wed, 11 Oct 2017 20:36:31 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41091) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e2RUB-0003VZ-Ec for emacs-orgmode@gnu.org; Wed, 11 Oct 2017 20:36:27 -0400 In-Reply-To: (Pierre-Luc Gauthier's message of "Mon, 9 Oct 2017 14:31:40 -0400") 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: Pierre-Luc Gauthier Cc: emacs-orgmode@gnu.org Pierre-Luc Gauthier 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