On Thu 19-Sep-2019 at 21:39:10 +02, garj...@garjola.net 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.