emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to include items (filtered) from other org files?
@ 2011-08-04  0:40 Michael Gilbert
  2011-08-04  3:14 ` Michael C Gilbert
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Gilbert @ 2011-08-04  0:40 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to include items (filtered) from other org files?
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Michael C Gilbert @ 2011-08-04  3:14 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

I'm going to narrow my question a bit because by now I've figured out that the most likely course to follow should be the use of a dynamic block. Is that correct?

What I'm not sure of is whether I need to develop a function from scratch to crawl through certain files for tasks with particular tags or whether there are functions that I can leverage to do this (such as some of the functions upon which the agenda depends, etc). I am way out of my depth on this one, but with a few pointers I feel like it may be a good way for me to keep learning....

TIA

— Michael



On Aug 3, 2011, at 5:40 PM, Michael Gilbert wrote:

> 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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to include items (filtered) from other org files?
  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
  2 siblings, 0 replies; 4+ messages in thread
From: suvayu ali @ 2011-08-04  8:06 UTC (permalink / raw)
  To: Michael Gilbert; +Cc: emacs-orgmode Mailinglist

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to include items (filtered) from other org files?
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Moe @ 2011-08-04  8:26 UTC (permalink / raw)
  To: Michael Gilbert; +Cc: emacs-orgmode Mailinglist

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
>
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-04  8:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).