emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* increase effort estimate on the fly.
@ 2009-06-09  9:42 Konstantin Antipin
  2009-06-17 13:57 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Antipin @ 2009-06-09  9:42 UTC (permalink / raw)
  To: emacs-orgmode mailing list

Dear all,

Recently new feature was added - when you set an estimated effort for
a task, you can be notified when time is up.
(sound is controlled with org-clock-sound variable)
I found that pretty often  from the beginning I can not correctly
estimate what time task will take and I need to give myself an
additional time.

To address this issue I wrote couple of functions that helps me with that.
What do they do:
When you have clocked item and want to add time (increase effort
estimate), you call function org-clock-increase-effort-estimate, which
will ask you for a time period. It will update update currently
clocked item in a buffer as well as a mode line.

I hope this might be helpful to someone

Kostya

defun org-clock-increase-effort-estimate (add-effort)
  "Add time to the effort estimate.
Update Effort property of currently clocked item.
Update mode line."
  (interactive "sHow much to add? (hh:mm or mm)? ")
  (if (and (org-clock-is-active) org-clock-effort)
      (let ((add-effort-minutes (org-string-to-minutes add-effort)))
	(progn (setq org-clock-effort (org-minutes-to-hh:mm-string
				       (+ add-effort-minutes
					  (org-hh:mm-string-to-minutes org-clock-effort))))
	       (org-clock-update-mode-line)
	       (message "about to increase effort.")
	       (org-clock-set-effort-estimate-in-buffer org-clock-effort)
	       )
	))
  )

(defun org-clock-set-effort-estimate-in-buffer (effort-string)
  "Increase effort estimate PROPERTY for the currently clocked item.
Jump to the correct buffer, increace the PROPERTY, jump back."
  (if (org-clock-is-active)
      (progn
	(let ((back-mark (point-marker)))
	  (org-clock-goto)
	  (org-set-property "Effort" effort-string)
	  (switch-to-buffer (marker-buffer back-mark))
	  (goto-char back-mark)
	  (message "Effort was increased.")
	  ))))



(defun org-string-to-minutes (string)
  "Recognizes two formats:
1:30 - converted to minutes
30   - interpreted as minutes."
  (case  (length (split-string string ":"))
    (2 (org-hh:mm-string-to-minutes string))
    (1 (string-to-int string))
    )
  )

(defun org-clock-is-active ()
  "Return true if clock is currently running.
nil otherwise."
  (if (marker-buffer org-clock-marker)
      t)
  )


;; Suggested bindings
(org-defkey org-mode-map "\C-c\C-x\C-e" 'org-clock-increase-effort-estimate)
(global-set-key "\C-c\C-x\C-e" 'org-clock-increase-effort-estimate)

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

* Re: increase effort estimate on the fly.
  2009-06-09  9:42 increase effort estimate on the fly Konstantin Antipin
@ 2009-06-17 13:57 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-06-17 13:57 UTC (permalink / raw)
  To: Konstantin Antipin; +Cc: emacs-orgmode mailing list

Hi Konstantin,

I have added this functionality, but without the global key binding.

Thanks!

- Carsten

On Jun 9, 2009, at 11:42 AM, Konstantin Antipin wrote:

> Dear all,
>
> Recently new feature was added - when you set an estimated effort for
> a task, you can be notified when time is up.
> (sound is controlled with org-clock-sound variable)
> I found that pretty often  from the beginning I can not correctly
> estimate what time task will take and I need to give myself an
> additional time.
>
> To address this issue I wrote couple of functions that helps me with  
> that.
> What do they do:
> When you have clocked item and want to add time (increase effort
> estimate), you call function org-clock-increase-effort-estimate, which
> will ask you for a time period. It will update update currently
> clocked item in a buffer as well as a mode line.
>
> I hope this might be helpful to someone
>
> Kostya
>
> defun org-clock-increase-effort-estimate (add-effort)
>  "Add time to the effort estimate.
> Update Effort property of currently clocked item.
> Update mode line."
>  (interactive "sHow much to add? (hh:mm or mm)? ")
>  (if (and (org-clock-is-active) org-clock-effort)
>      (let ((add-effort-minutes (org-string-to-minutes add-effort)))
> 	(progn (setq org-clock-effort (org-minutes-to-hh:mm-string
> 				       (+ add-effort-minutes
> 					  (org-hh:mm-string-to-minutes org-clock-effort))))
> 	       (org-clock-update-mode-line)
> 	       (message "about to increase effort.")
> 	       (org-clock-set-effort-estimate-in-buffer org-clock-effort)
> 	       )
> 	))
>  )
>
> (defun org-clock-set-effort-estimate-in-buffer (effort-string)
>  "Increase effort estimate PROPERTY for the currently clocked item.
> Jump to the correct buffer, increace the PROPERTY, jump back."
>  (if (org-clock-is-active)
>      (progn
> 	(let ((back-mark (point-marker)))
> 	  (org-clock-goto)
> 	  (org-set-property "Effort" effort-string)
> 	  (switch-to-buffer (marker-buffer back-mark))
> 	  (goto-char back-mark)
> 	  (message "Effort was increased.")
> 	  ))))
>
>
>
> (defun org-string-to-minutes (string)
>  "Recognizes two formats:
> 1:30 - converted to minutes
> 30   - interpreted as minutes."
>  (case  (length (split-string string ":"))
>    (2 (org-hh:mm-string-to-minutes string))
>    (1 (string-to-int string))
>    )
>  )
>
> (defun org-clock-is-active ()
>  "Return true if clock is currently running.
> nil otherwise."
>  (if (marker-buffer org-clock-marker)
>      t)
>  )
>
>
> ;; Suggested bindings
> (org-defkey org-mode-map "\C-c\C-x\C-e" 'org-clock-increase-effort- 
> estimate)
> (global-set-key "\C-c\C-x\C-e" 'org-clock-increase-effort-estimate)
>
>
> _______________________________________________
> 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

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

end of thread, other threads:[~2009-06-17 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-09  9:42 increase effort estimate on the fly Konstantin Antipin
2009-06-17 13:57 ` Carsten Dominik

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