[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: Project management > Dynamic block per tag + [Babel]
From: |
Juan Reyero |
Subject: |
Re: [Orgmode] Re: Project management > Dynamic block per tag + [Babel] |
Date: |
Wed, 19 Jan 2011 16:15:46 +0100 |
On Thu, Dec 16, 2010 at 1:19 PM, Francesco Pizzolante
<address@hidden> wrote:
> > Another option is to use a babel block and org-map-entries to spit out a
> > simple list of tasks for each person:
> I've played a little with the code you've sent and here's what I end up with:
>
> --8<---------------cut here---------------start------------->8---
> #+source: tasklist
> #+begin_src emacs-lisp :var person="FPZ" :results raw
> (setq org-agenda-files (list (buffer-file-name)))
> (let (tasklist)
> (add-to-list 'tasklist "|<c>|||" t)
> (org-map-entries
> (lambda ()
> (let ((priority (nth 3 (org-heading-components))))
> (add-to-list 'tasklist
> (concat "| *" (nth 2 (org-heading-components)) "* "
> "|/[#" (char-to-string (if priority
> priority ?B)) "]/ "
> "| [[" (nth 4 (org-heading-components)) "]]|") t)))
> (concat person "/!TODO|STARTED|WAIT") 'agenda)
> (mapconcat 'identity tasklist "\n"))
> #+end_src
> --8<---------------cut here---------------end--------------->8---
>
> The next step for me, would be to be able to sort this table against
> priorities for instance.
>
> If you think about a simple way of doing this, please let me know.
I had the same problem, and tweaking your code (I think org-mode
doesn't like the modification of org-agenda-files) this is what I've
ended up with:
(defun tasks-with-tag (person &optional scope)
(let ((tasklist ()))
(org-map-entries
(lambda ()
(let ((priority (nth 3 (org-heading-components))))
(add-to-list 'tasklist
(list (if priority (char-to-string priority) "C")
(concat "[[" (nth 4 (org-heading-components)) "]]"))
t)))
(concat person "/!TASK") scope)
(sort tasklist (lambda (f s)
(string-lessp (car f) (car s))))))
The output is sorted and makes a nice table. Scope is passed directly
to org-map-entries, so if you leave it out the scope will be the
current buffer.
Greetings,
jm
--
http://juanreyero.com/
http://alandair.com
- Re: [Orgmode] Re: Project management > Dynamic block per tag + [Babel],
Juan Reyero <=