From mboxrd@z Thu Jan 1 00:00:00 1970 From: suvayu ali Subject: Re: how to include items (filtered) from other org files? Date: Thu, 4 Aug 2011 10:06:19 +0200 Message-ID: References: <3C5C49D0-44E9-4F0D-A37C-9C7D74A05514@gilbert.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qoswz-0002h9-BZ for emacs-orgmode@gnu.org; Thu, 04 Aug 2011 04:06:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qoswy-0001S9-DJ for emacs-orgmode@gnu.org; Thu, 04 Aug 2011 04:06:41 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:39990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qoswy-0001S2-8i for emacs-orgmode@gnu.org; Thu, 04 Aug 2011 04:06:40 -0400 Received: by fxg9 with SMTP id 9so108300fxg.0 for ; Thu, 04 Aug 2011 01:06:39 -0700 (PDT) In-Reply-To: <3C5C49D0-44E9-4F0D-A37C-9C7D74A05514@gilbert.org> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Michael Gilbert Cc: emacs-orgmode Mailinglist Hi Michael, On Thu, Aug 4, 2011 at 2:40 AM, Michael Gilbert wrote: > I manage a lot of complex, overlapping projects. One of these projects is= a regular newsletter. Half of the content that goes out in this newsletter= is created by the newsletter program itself. The other half is the result = of several other projects, which produce reports and articles that get publ= ished in the newsletter. The publishing task in all those other projects ar= e tagged with an 'nnpublish' tag. > > I want to be able to work on the newsletter project in one place. I don't= want to maintain duplicate tasks in wildly different places. (You can imag= ine how out of hand this would get.) What I want to do is INCLUDE all of th= e other publishing tasks programmatically in the org file that I use to man= age the newsletter. I am completely stymied as to how to do this. > I use the following function to export org source from a tags search to a temporary buffer. Maybe you can alter it for your needs to create the newsletter based on the 'nnpublish' tag? #+begin_src emacs-lisp ;; Export tags search result to a temporary buffer (defun org-tags-search-to-buffer(match) "Do a tags search and copy the results to the temporary buffer \"*temp*\"." (interactive "sSearch for: " ) (let* ((agenda-files (org-agenda-files t))) (switch-to-buffer "*temp*") (org-mode) (dolist (buf agenda-files) (save-excursion (find-file buf) (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match))) (beginning-of-buffer) (while (condition-case nil (org-occur-next-match 1) (error nil)) (if (org-inlinetask-at-task-p) (org-copy-subtree 2) (org-copy-subtree)) (kill-append "\n" nil) (append-next-kill)))) (switch-to-buffer "*temp*") (goto-char (point-max)) (yank))) #+end_src Hope this helps. --=20 Suvayu Open source is the future. It sets us free.