emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.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, 04 Aug 2011 10:26:37 +0200	[thread overview]
Message-ID: <4E3A57BD.7000201@christianmoe.com> (raw)
In-Reply-To: <3C5C49D0-44E9-4F0D-A37C-9C7D74A05514@gilbert.org>

Hi,

If I understand you correctly, you want to import into your current 
Org document tasks from other Org files that match a certain tag.

Here's one attempt; I'm sure there are better solutions, and solutions 
involving Agenda commands, which I don't understand very well.

Assuming all items are in agenda files: Evaluate the following, place 
point where you want the items, then call my/org-import-tasks and 
answer "nnpublish" at the prompt.

#+begin_src emacs-lisp
   (defun my/org-import-tasks (match)
     "Import tasks with MATCH from all agenda files into present 
buffer at point."
     (interactive "MMatch: ")
     (let ((files (org-agenda-files))
           (this (current-buffer)))
       (while files
         (find-file (car files))
         (org-map-entries
          (lambda ()
            (org-copy-subtree)
            (with-current-buffer this (yank)))
          match)
         (kill-buffer)
         (setq files (cdr files)))))
#+end_src

Yours,
Christian


On 8/4/11 2:40 AM, Michael Gilbert wrote:
> Hi —
>
> Here's my challenge:
>
> 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.
>
> The only information that I've had a change to look at that touches
> on the matter of including other files is in section 11.4 of the
> manual. If I'm not mistaken, it applies only to export. And the
> only processing that can be applied to the file being included is a
> limitation on which lines to include. Unless I'm missing something,
> this isn't going to meet my needs. I'm wondering if perhaps I need
> to be looking at code blocks. Maybe something that uses agenda code
> to grab items and then renders them in place. Oh hell, I don't
> know.
>
> I'm pretty lost as to how to pursue this. Any thoughts?
>
> TIA!
>
> — Michael
>
>
>
>

      parent reply	other threads:[~2011-08-04  8:23 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
2011-08-04  8:26 ` Christian Moe [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=4E3A57BD.7000201@christianmoe.com \
    --to=mail@christianmoe.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).