emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] how to include items (filtered) from other org files?


From: Christian Moe
Subject: Re: [O] how to include items (filtered) from other org files?
Date: Thu, 04 Aug 2011 10:26:37 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11

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








reply via email to

[Prev in Thread] Current Thread [Next in Thread]