emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: suvayu ali <fatkasuvayu+linux@gmail.com>
To: Michael Gilbert <mcg@gilbert.org>
Cc: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: how to include items (filtered) from other org files?
Date: Thu, 4 Aug 2011 10:06:19 +0200	[thread overview]
Message-ID: <CAMXnza2ismkMK2p0xno+JV26ctqxBOp_bcE+C4c=vgKjW+KYYA@mail.gmail.com> (raw)
In-Reply-To: <3C5C49D0-44E9-4F0D-A37C-9C7D74A05514@gilbert.org>

Hi Michael,

On Thu, Aug 4, 2011 at 2:40 AM, Michael Gilbert <mcg@gilbert.org> 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.

  parent reply	other threads:[~2011-08-04  8:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04  0:40 how to include items (filtered) from other org files? Michael Gilbert
2011-08-04  3:14 ` Michael C Gilbert
2011-08-04  8:06 ` suvayu ali [this message]
2011-08-04  8:26 ` Christian Moe

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='CAMXnza2ismkMK2p0xno+JV26ctqxBOp_bcE+C4c=vgKjW+KYYA@mail.gmail.com' \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mcg@gilbert.org \
    /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).