emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@uva.nl>
To: Vladi Solutka <mmlists@eml.cc>
Cc: emacs-orgmode@gnu.org
Subject: Re: Overview of agenda files
Date: Fri, 26 Sep 2008 18:10:13 +0200	[thread overview]
Message-ID: <B1645AFA-2E62-45A8-83BA-7C6A3D6A15F8@uva.nl> (raw)
In-Reply-To: <1222255681.24243.1275691879@webmail.messagingengine.com>

Hi Vladi,

On Sep 24, 2008, at 1:28 PM, Vladi Solutka wrote:

> Hi!
>
> First: Thanks for orgmode! Didn't know that it would be possible to
> love my emacs even more :-))
>
> After I'd watched Dominiks Google Talk about org-mode (thanks for
> that, very interesting), I started to organize my stuff in a more
> "information centric" way. It looks like this is a very good approach
> especially when handling small, but long running projects.
>
> All I currently miss is the possibility to have a top overview of my
> projects, listing the count of the different keywords (since each
> project has its own file, this would be in fact an overview of my
> agenda files). This would give me a quick overview of the status of
> each project and would be a perfect starting point when
> checking/digging into my projects, especially if the counts and
> filenames would be links ...
>
> Example:
>
> |-------+------+------+-------|
> | File  | TODO | WAIT | LATER |
> |-------+------+------+-------|
> | File1 |    5 |    2 |    10 |
> | File2 |    2 |    2 |       |
> | File3 |   12 |    0 |     0 |
> |-------+------+------+-------|
>
>
> Did anyone something like that before? Or is this maybe already
> possible with orgmode?

There is nothing built-in to make something like this, but using  
dynamic blocks and the entry mapper, it can be implemented compactly.

Load the following code, in .emacs or so....

(defun org-dblock-write:count-todo-states (params)
  (let ((states (or (plist-get params :states) '("TODO")))
	table file entry tbl)
    ;; Map over all entries
    (apply 'org-map-entries 'my-count-todo-states-internal
	   nil 'agenda params)
    (setq table (nreverse table))
    ;; Insert headline
    (insert "|File|" (mapconcat 'identity states "|") "|\n|-")
    ;; Insert the counts
    (while (setq entry (pop table))
      (setq file (car entry) tbl (cdr entry))
      (insert "\n|[[file:" file "][" (file-name-nondirectory file) "]]|"
	      (mapconcat (lambda (x) (number-to-string
				      (or (cdr (assoc x tbl)) 0)))
			 states "|")
	      "|"))
    ;; Align the table
    (org-table-align)))

(defun my-count-todo-states-internal ()
  "Count TODO keywords per file, into dynamically scoped variable  
`table'."
  (let ((todo (org-get-todo-state))
	(bfn (buffer-file-name))
	a a1)
    (if (not (assoc bfn table))
        ;; Add entry for this new file name
	(push (list bfn) table))
    (setq a (assoc bfn table))
    (if (not (assoc todo (cdr a)))
        ;; Add entry for this new TODO keyword
	(setcdr a (cons (cons todo 0) (cdr a))))
    (setq a1 (assoc todo (cdr a)))
    (setcdr a1 (1+ (cdr a1)))))


Then put the following two lines into an Org-mode buffer

#+BEGIN: count-todo-states :states ("TODO" "WAIT" "LATER")
#+END: count-todo-states

Each time you press `C-c C-c' on te BEGIN line, the table you are  
looking for
will be updated between these two lines.  I have made the file names  
links,
I am not sure what you mean by making links of the counts.....

HTH

- Carsten

  reply	other threads:[~2008-09-26 16:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-24 11:28 Overview of agenda files Vladi Solutka
2008-09-26 16:10 ` Carsten Dominik [this message]
2008-09-28 20:39   ` Vladi Solutka
2008-09-29  3:09     ` Manish
2008-09-29  5:51       ` Carsten Dominik
2008-10-01 17:01         ` Vladi Solutka

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=B1645AFA-2E62-45A8-83BA-7C6A3D6A15F8@uva.nl \
    --to=dominik@uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=mmlists@eml.cc \
    /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).