emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: <garjola@garjola.net>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Effort estimates on repeating tasks
Date: Thu, 03 Oct 2019 22:07:01 +0200	[thread overview]
Message-ID: <87lfu1r3tm.fsf@pc-117-162.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <87a7b0rs81.fsf@pc-117-162.i-did-not-set--mail-host-address--so-tickle-me> (garjola@garjola.net's message of "Thu, 19 Sep 2019 21:39:10 +0200")

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

      reply	other threads:[~2019-10-03 20:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 19:39 Effort estimates on repeating tasks garjola
2019-10-03 20:07 ` garjola [this message]

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=87lfu1r3tm.fsf@pc-117-162.i-did-not-set--mail-host-address--so-tickle-me \
    --to=garjola@garjola.net \
    --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).