emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Effort estimates on repeating tasks


From: garjola
Subject: Re: [O] Effort estimates on repeating tasks
Date: Thu, 03 Oct 2019 22:07:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Thu 19-Sep-2019 at 21:39:10 +02, address@hidden wrote: 
> Hi,
>
> I like the warning in the mode line when the time clocked on a task goes
> beyond the effort estimates in the properties drawer.
>
> However, I don’t know how to use this for repeating tasks or habits.
> That is, I want to work on a given task every day for less than N
> minutes and be warned when going beyond this amount. Of course,
> using the Effort property will warn me the first time, but will be
> useless after that, unless I delete the clocked time at the beginning of
> each new session.
>
> Is there a way to do that properly?
>
> Thanks in advance for your help.
>
> G.

Hi,

I have been investigating this and I think I could advice 
org-clock-get-clock-string. I have never written advices to functions and I 
don’t know org’s API.

Since I want to change the clock string only for repeating tasks, I have done 
this, which just adds “Repeating” to the clock string when clocking a repeating 
task:

#+BEGIN_SRC emacs-lisp
(defun ocgcs (orig-fun &rest args)
  "Advice for effort in repeating tasks"
  (progn
    (if (org-entry-get (point) "LAST_REPEAT")
        (concat "Repeating" 
                (apply orig-fun args))
      (apply orig-fun args))))
(advice-add 'org-clock-get-clock-string :around #'ocgcs)
#+END_SRC

What I would like to do now is getting the total time clocked today for the 
task and then compare it to the Effot property value. I have found how to get 
the total amount of time clocked for the task, but I don’t know how to limit 
this to today.

Any ideas?

Thank you.

G.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]