Hi Michael,
On Thu, Aug 4, 2011 at 2:40 AM, Michael Gilbert <[email protected]> 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 published
> in the newsletter. The publishing task in all those other projects are 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 imagine
> how out of hand this would get.) What I want to do is INCLUDE all of the
> other publishing tasks programmatically in the org file that I use to manage
> 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.
--
Suvayu
Open source is the future. It sets us free.