emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: James TD Smith <ahktenzero@mohorovi.cc>
To: emacs-orgmode@gnu.org
Subject: [PATCH 3/7] Show durations of clocked times in timeline
Date: Fri, 25 Jul 2008 00:46:18 +0100	[thread overview]
Message-ID: <20080724234618.23478.77283.stgit@nyarlathotep.internal.mohorovi.cc> (raw)
In-Reply-To: <20080724234608.23478.48564.stgit@nyarlathotep.internal.mohorovi.cc>

In the timeline display in the agenda, show the length of time clocked as well
as the start and end times.
---

 lisp/ChangeLog     |    3 +++
 lisp/org-agenda.el |   14 ++++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c81a049..e63503a 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
 2008-07-25  James TD Smith  <ahktenzero@mohorovi.cc>
 
+	* org-agenda.el (org-agenda-get-closed): show durations of clocked
+	items as well as the start and end times.
+
 	* org-compat.el (org-get-x-clipboard-compat): Add a compat
 	function for fetching the X clipboard on XEmacs and GNU Emacs 21.
 
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 23cda50..2f07535 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3325,7 +3325,7 @@ the documentation of `org-diary'."
 			    (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
 		    1 11))))
 	 marker hdmarker priority category tags closedp
-	 ee txt timestr rest)
+	 ee txt timestr rest clocked)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
@@ -3341,10 +3341,11 @@ the documentation of `org-diary'."
 	  (setq rest (substring timestr (match-end 0))
 		timestr (substring timestr 0 (match-end 0)))
 	  (if (and (not closedp)
-		   (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\]" rest))
-	      (setq timestr (concat (substring timestr 0 -1)
-				    "-" (match-string 1 rest) "]"))))
-		
+		   (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)" rest))
+	      (progn (setq timestr (concat (substring timestr 0 -1)
+					   "-" (match-string 1 rest) "]"))
+		     (setq clocked (match-string 2 rest)))
+	    (setq clocked "-")))
 	(save-excursion
 	  (if (re-search-backward "^\\*+ " nil t)
 	      (progn
@@ -3353,7 +3354,8 @@ the documentation of `org-diary'."
 		      tags (org-get-tags-at))
 		(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
 		(setq txt (org-format-agenda-item
-			   (if closedp "Closed:    " "Clocked:   ")
+			   (if closedp "Closed:    "
+			     (concat "Clocked:   (" clocked  ")"))
 			   (match-string 1) category tags timestr)))
 	    (setq txt org-agenda-no-heading-message))
 	  (setq priority 100000)

  parent reply	other threads:[~2008-07-24 23:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 23:46 [PATCH 1/7] Some improvements to the modeline clock display James TD Smith
2008-07-24 23:46 ` [PATCH 2/7] Fix X clipboard handling in emacs21 James TD Smith
2008-07-24 23:46 ` James TD Smith [this message]
2008-07-24 23:46 ` [PATCH 4/7] Fix link display in imenus and the refile interface James TD Smith
2008-07-24 23:46 ` [PATCH 5/7] Fix note insertion in entries with drawers James TD Smith
2008-07-24 23:46 ` [PATCH 6/7] Add some functions for handling checklists James TD Smith
2008-07-24 23:46 ` [PATCH 7/7] Add some new interaction between remember and clocked tasks James TD Smith

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=20080724234618.23478.77283.stgit@nyarlathotep.internal.mohorovi.cc \
    --to=ahktenzero@mohorovi.cc \
    --cc=emacs-orgmode@gnu.org \
    /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).