emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Konstantin Antipin <antipin.konstantin@googlemail.com>
To: Eraldo Helal <admin@eraldo.at>
Cc: emacs-orgmode@gnu.org
Subject: Re: timer for a task
Date: Mon, 25 May 2009 17:43:36 +0200	[thread overview]
Message-ID: <61176df0905250843n3da682c2xc46280c7b6c24670@mail.gmail.com> (raw)
In-Reply-To: <938fae2d0905250344i71979176yc7f0b6e47380ce6f@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3619 bytes --]

Here is the patch to org-clock.el that does show estimated effort in
the mode-line if it is set.  Like so: 01:20/01:30 (clocked
time/estimated time)
  It does it by:
    * Setting new variable org-clock-effort in org-clock-in function.
    * If org-clock-effort is not nil, show estimated effort in the mode-line.

I would like to go further and do the following:
* Make a beep/or highlight if we spend more time on a task that
initially intended
* As proposed by Daniel, give user an option to see total time, spend
on the task instead of currently clocked time.

Does somebody else need this? Will this changes be accepted to the
orgmode-core?
I just saw that in order to contribute, you need to sign some papers..
Is this the only way?
I am new to open-source, so I am not really familiar with such things.

best,
Konstantin


On Mon, May 25, 2009 at 12:44 PM, Eraldo Helal <admin@eraldo.at> wrote:
> Sounds good to me.
>
> Eraldo
>
> On Mon, May 25, 2009 at 12:30, Konstantin Antipin
> <antipin.konstantin@googlemail.com> wrote:
>> Hi Daniel,
>> Yes, you are right indeed. I am talking about effort estimates - I'v
>> missed this chapter for some reason from the manual.
>> I like the idea you proposed - to show how much time is left in the
>> mode line. And I think I am going to write necessary code for this.
>>
>> Or, may be someone has even better idea?
>>
>> best,
>> Konstantin
>>
>> On Mon, May 25, 2009 at 11:25 AM, Daniel Clemente <n142857@gmail.com> wrote:
>>>
>>> Hi.
>>>  I suppose you talk about estimated efforts. I also have noticed that I work better if I have defined them, but it is very easy to miss them and work on a task more time than planned.
>>>  An easy improvement would be to show at the mode line not only how much time you have worked on the current task but also the remaining time according to your effort estimate. And if it comes to 0, highlight it noticeably.
>>>
>>>  Other useful things to show would be the *total* elapsed time (not only the elapsed time of the last C-c C-x C-i) or directly the effort estimate (instead of the remaining time, the total time).
>>>
>>>  And as you say, an alarm would be useful.
>>>
>>> -- Daniel
>>>
>>> El dl, mai 25 2009, Konstantin Antipin va escriure:
>>>> Hi everybody!
>>>> I am constantly trying to be more productive, and there is one thing
>>>> that I noticed:
>>>> If you give yourself a specific time for a task, then you tend to
>>>> finish this task in this time. It helps to stay focused and do stuff
>>>> that is most important.
>>>>
>>>> So, the question is - Is there any way to set a timer on a taks, and
>>>> get a bell when it is expired?
>>>> Some time before I even wrote a small extension that helps me to do
>>>> that http://www.emacswiki.org/emacs/tea-time
>>>> But now I am thinking - is there an orgmode-way to do that? It would
>>>> be great to integrate it with great time tracking system, for
>>>> example...
>>>> If nobody uses proposed feature, please give me a hint how it would be
>>>> best to do that.
>>>>
>>>>
>>>> my best,
>>>> Konstantin
>>>>
>>>>
>>>> _______________________________________________
>>>> Emacs-orgmode mailing list
>>>> Remember: use `Reply All' to send replies to the list.
>>>> Emacs-orgmode@gnu.org
>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>

[-- Attachment #2: clock-efforts.patch --]
[-- Type: text/x-patch, Size: 3799 bytes --]

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 87ca180..445a336 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -158,6 +158,9 @@ All this depends on running `org-clock-persistence-insinuate' in .emacs"
 (defvar org-clock-heading-for-remember "")
 (defvar org-clock-start-time "")
 
+(defvar org-clock-effort "" 
+  "Effort estimate of the currently clocking task")
+
 (defvar org-clock-history nil
   "List of marker pointing to recent clocked tasks.")
 
@@ -267,23 +270,50 @@ pointing to it."
 	(cons i marker)))))
 
 (defun org-clock-update-mode-line ()
-  (let* ((delta (- (time-to-seconds (current-time))
-		   (time-to-seconds org-clock-start-time)))
-	 (h (floor delta 3600))
-	 (m (floor (- delta (* 3600 h)) 60)))
-    (setq org-mode-line-string
-	  (org-propertize
-	   (let ((clock-string (format (concat "-[" org-time-clocksum-format " (%s)]")
-				       h m org-clock-heading))
-		 (help-text "Org-mode clock is running. Mouse-2 to go there."))
-	     (if (and (> org-clock-string-limit 0)
-		      (> (length clock-string) org-clock-string-limit))
-		 (org-propertize (substring clock-string 0 org-clock-string-limit)
-			     'help-echo (concat help-text ": " org-clock-heading))
-	       (org-propertize clock-string 'help-echo help-text)))
-	   'local-map org-clock-mode-line-map
-	   'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight)))
-    (force-mode-line-update)))
+  (setq org-mode-line-string
+	(org-propertize
+	 (let ((clock-string (org-clock-get-clock-string))
+	       (help-text "Org-mode clock is running. Mouse-2 to go there."))
+	   (if (and (> org-clock-string-limit 0)
+		    (> (length clock-string) org-clock-string-limit))
+	       (org-propertize (substring clock-string 0 org-clock-string-limit)
+			       'help-echo (concat help-text ": " org-clock-heading))
+	     (org-propertize clock-string 'help-echo help-text)))
+	 'local-map org-clock-mode-line-map
+	 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight)))
+  (force-mode-line-update))
+
+(defun org-clock-get-clock-string ()
+  "Form a clock-string, that will be show in the mode line.
+If effort estimate was defined for current item, then use 01:30/01:50 format (clocked/estimated).
+If not, then 01:50 format (clocked).
+"
+  (let* ((clocked-time (org-clock-get-clocked-time))
+	 (h (floor clocked-time 3600))
+	 (m (floor (- clocked-time (* 3600 h)) 60))
+	 )
+    (if (and org-clock-effort)
+	(let* ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
+	       (effort-h (floor effort-in-minutes 60))
+	       (effort-m (- effort-in-minutes (* effort-h 60))) 
+	       )
+	  (format (concat "-[" org-time-clocksum-format "/" org-time-clocksum-format " (%s)]")
+		  h m effort-h effort-m  org-clock-heading)
+	  )
+      (format (concat "-[" org-time-clocksum-format " (%s)]")
+	      h m org-clock-heading))
+    ))
+
+(defun org-clock-get-clocked-time ()
+  ""
+  (let ((currently-clocked-time (- (time-to-seconds (current-time))
+				   (time-to-seconds org-clock-start-time))))
+    ;; (if org-clock-show-total-time
+    ;; 	;; TODO: make total-clocked-time TOTAL, and not current clocked time :)
+    ;; 	currently-clocked-time
+    currently-clocked-time
+    ;; )					
+    ))
 
 (defvar org-clock-mode-line-entry nil
   "Information for the modeline about the running clock.")
@@ -387,6 +417,7 @@ the clocking selection, associated with the letter `d'."
 		(beginning-of-line 1)
 		(org-indent-line-to (- (org-get-indentation) 2)))
 	      (insert org-clock-string " ")
+	      (setq org-clock-effort (org-get-effort))
 	      (setq org-clock-start-time (current-time))
 	      (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive))))
 	    (move-marker org-clock-marker (point) (buffer-base-buffer))

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2009-05-25 15:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-25  8:40 timer for a task Konstantin Antipin
2009-05-25  9:25 ` Daniel Clemente
2009-05-25 10:30   ` Konstantin Antipin
2009-05-25 10:44     ` Eraldo Helal
2009-05-25 15:43       ` Konstantin Antipin [this message]
2009-05-26 13:18         ` Carsten Dominik
2009-05-26 14:26           ` Konstantin Antipin
2009-05-26 14:45             ` Carsten Dominik
2009-05-26 22:13               ` Konstantin Antipin
2009-05-27  4:27                 ` Carsten Dominik
2009-05-27 13:32                   ` Bernt Hansen
2009-05-28  0:02                     ` Konstantin Antipin

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=61176df0905250843n3da682c2xc46280c7b6c24670@mail.gmail.com \
    --to=antipin.konstantin@googlemail.com \
    --cc=admin@eraldo.at \
    --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).