emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-dblock-write:count
@ 2014-02-09 13:03 Adam Spiers
  2014-02-10  9:50 ` org-dblock-write:count Sebastien Vauban
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Spiers @ 2014-02-09 13:03 UTC (permalink / raw)
  To: org-mode mailing list

Hi all,

I just had an awesome conversation with Sacha about more effective
daily/weekly reviewing with org-mode :-)  One of the things we talked
about was quantifying the number of tasks (TODO keywords) in any given
state, as a means of becoming more aware of your progress over time.
I have had some success in the past using the "measure what you want
to manage maxim"[1], and wanted to start applying this to my horribly
massive TODO.org file.

Back in 2008, Carsten very generously implemented the
`org-map-entries' API function at my request[2] in order to facilitate
this kind of measurement, and I'm somewhat ashamed to say that I've
only just started to take advantage of it:

    (defun org-count-matches (search)
      "Count the number of matches from the given tag search in the
    current buffer, respecting any scope restriction."
      (interactive "sMatch: ")
      (length (org-map-entries t search)))

    (defun org-dblock-write:count (params)
      "Write a table showing the number of occurrences of each of the
    specified keywords and tag searches.  Example usage:

    #+BEGIN:dynamic block
    #+BEGIN: count :keywords (\"NEXT\" \"DONE\") :searches (\"@phone\" \"@home\")
    | NEXT       | 522 |
    | DONE       |  69 |
    | @phone     |  77 |
    | @home      | 182 |
    #+END:
    "
      (let ((keywords (plist-get params :keywords))
            (searches (plist-get params :searches))
            (format "| %-10s | %3d |\n"))
        (insert
         (concat
          (mapconcat (lambda (keyword)
                       (format format keyword (org-count-matches
                                               (concat "/" keyword))))
                     keywords "")
          (mapconcat (lambda (search)
                       (format format search (org-count-matches search)))
                     searches "")))
        (backward-delete-char 1)))

Sacha deserves a lot of credit for reminding me how easy it would be
to do this :-)

I suppose the next step would be to automate appending counts to a CSV
file or transmitting them to some kind of graphing service like
https://tempo-db.com/ (or preferably some free alternative like
quantifiedawesome ;-) via a REST API.

[1] http://blog.adamspiers.org/2011/05/15/email-nirvana/
[2] http://lists.gnu.org/archive/html/emacs-orgmode/2008-06/msg00208.html

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

end of thread, other threads:[~2014-02-14 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-09 13:03 org-dblock-write:count Adam Spiers
2014-02-10  9:50 ` org-dblock-write:count Sebastien Vauban
2014-02-14 12:42   ` org-dblock-write:count Sebastien Vauban

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