emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Juan Reyero <joanmg@gmail.com>
To: Francesco Pizzolante <fpz@missioncriticalit.com>,
	mailing-list-org-mode <emacs-orgmode@gnu.org>
Subject: Re: Re: Project management > Dynamic block per tag + [Babel]
Date: Wed, 19 Jan 2011 16:15:46 +0100	[thread overview]
Message-ID: <AANLkTinW6=ON6=G6-uMNniQjC4uUHJUC5_tZadtHBdaG@mail.gmail.com> (raw)
In-Reply-To: <AANLkTingk4g9SxzewOs4LiALe=6PbC1bu1ADd5qD44R-@mail.gmail.com>

On Thu, Dec 16, 2010 at 1:19 PM, Francesco Pizzolante
<fpz@missioncriticalit.com> 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

  reply	other threads:[~2011-01-19 15:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 11:21 Project management > Dynamic block per tag + [Babel] Francesco Pizzolante
2010-11-26 13:40 ` Christian Egli
2010-11-28 20:40 ` Matt Lundin
2010-12-09 17:03   ` Francesco Pizzolante
2010-12-16 12:19   ` Francesco Pizzolante
2011-01-19 15:15     ` Juan Reyero [this message]
     [not found]   ` <87tyiw6rmg.fsf@mundaneum.com>
2011-01-28 15:57     ` Matt Lundin

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='AANLkTinW6=ON6=G6-uMNniQjC4uUHJUC5_tZadtHBdaG@mail.gmail.com' \
    --to=joanmg@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=fpz@missioncriticalit.com \
    /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).