From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fletcher Charest Subject: Re: Custom forwarding for a scheduled task Date: Sat, 26 Oct 2013 11:44:41 +0200 Message-ID: References: <868uxmh1ul.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b3a8c305add9d04e9a1b706 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Va0QH-0000up-LT for emacs-orgmode@gnu.org; Sat, 26 Oct 2013 05:44:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Va0QG-0002an-3t for emacs-orgmode@gnu.org; Sat, 26 Oct 2013 05:44:45 -0400 Received: from mail-wg0-x231.google.com ([2a00:1450:400c:c00::231]:45270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Va0QF-0002aS-OT for emacs-orgmode@gnu.org; Sat, 26 Oct 2013 05:44:44 -0400 Received: by mail-wg0-f49.google.com with SMTP id x12so4710399wgg.4 for ; Sat, 26 Oct 2013 02:44:42 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastien Vauban Cc: emacs-orgmode@gnu.org --047d7b3a8c305add9d04e9a1b706 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Dear all, In case someone would be interested, I came up with an ugly hack, nor robust or elegant, but it works... It iterates over all headings, check if the current heading has a property "reschedule" and a "TODO" state, and if the number of days passed in the current year for today is greater than the number of days passed in the current year when the task was scheduled (quite clumsy, but I couldn't find another way to do it...). If these conditions are met, the task get cancelled. #+BEGIN_SRC emacs-lisp (defun fc/org-forward-task-if-not-done () (interactive) (save-excursion (goto-char (point-max)) (while (outline-previous-heading) (when (and (org-entry-get (point) "reschedule") (equal "TODO" (cdar (org-entry-properties))) (> (string-to-number (format-time-string "%j")) (string-to-number (format-time-string "%j" (org-get-scheduled-time (point)))))) (org-todo "CANCELLED"))))) (global-set-key (kbd "s-f") 'fc/org-forward-task-if-not-done) #+END_SRC When used on a task like this... * TODO test :PROPERTIES: :reschedule: yes :LOGGING: CANCELLED(!) :END: SCHEDULED: <2013-10-24 jeu. ++1w> ...when I press , the task is automatically scheduled to the next thursday (from today) if it was not done starting from 2013-10-25. Best regards, FC On Wed, Oct 23, 2013 at 3:37 PM, Fletcher Charest < fletcher.charest@gmail.com> wrote: > Dear S=E9bastien, > > Thank you for your answer, it is useful. Now I can see that I already > worked on a task even if I reschedule it and don't see the "Sched. 2x" > mention. But I still have to manually reschedule the task to the next wee= k, > which is what I *really* want to avoid, even at the price of not seeing > what I already did either in the form of clocking time or with the "Sched= . > 2x" mention (maybe this wasn't clear in my first message). > > I will try to write something with my very poor level of emacs-lisp. My > reasoning would be something like: "if a task that has this particular > property was scheduled for being done x days ago (with x > 0), and if it = is > not marked DONE, then reschedule it (7 - x) days later". I could maybe > include a comment saying that this task was automatically rescheduled, wi= th > a timestamp. I just hope I'm not reinventing the wheel somewhere in that > process. > > Best regards > > > On Mon, Oct 21, 2013 at 9:15 PM, Sebastien Vauban > wrote: > >> Hello Fletcher, >> >> Fletcher Charest wrote: >> > First of all, apologies if I'm doing something wrong - I'm not used to >> > posting in mailing lists. >> > >> > I read in the Org manual, about scheduled tasks : >> > >> > "A reminder that the scheduled date has passed will be present in the >> > compilation for today, until the entry is marked DONE, i.e., the task >> will >> > automatically be forwarded until completed." >> > >> > Sometimes, I schedule a task but can only carry out my second day of >> work >> > on that task one week later (or my first day if I couldn't work on it = on >> > the scheduled day). I would like to know if it is possible to schedule= a >> > task, for example, on a Sunday, and see it appear in the agenda the ne= xt >> > Sunday with the mention "Sched. 2x: TODO my task". This way I know I >> have >> > to carry out my second day of work on that task on that day. >> > >> > I tried to use delays for this but couldn't obtain anything. >> > >> > I'm sorry if this is standard functionality or if it has been answered >> > somewhere. I usually find all my answers about org-mode online but thi= s >> > time I couldn't find any info. >> >> This hasn't been answered yet, neither is it a common request. >> >> FWIW, I removed such scheduling info (2x, 3x...) because it scared me to >> hell >> when it went over 99 days delay. >> >> But, to answer you, no, I don't think it's doable in the current system. >> Though, you could get more or less the same functionality by clocking >> time, >> rescheduling your task for the available Sunday, and clock again. On tha= t >> day, >> you would see that you're clocking hours 8 to 15 of your work. >> >> Best regards, >> Seb >> >> -- >> Sebastien Vauban >> >> >> > --047d7b3a8c305add9d04e9a1b706 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Dear all,

In case so= meone would be interested, I came up with an ugly hack, nor robust or elega= nt, but it works... It iterates over all headings, check if the current hea= ding has a property "reschedule" and a "TODO" state, an= d if the number of days passed in the current year for today is greater tha= n the number of days passed in the current year when the task was scheduled= (quite clumsy, but I couldn't find another way to do it...). If these = conditions are met, the task get cancelled.

#+BEGIN_SRC emacs-lis= p
=A0 (defun fc/org-forward-task-if-not-done ()
=A0=A0=A0 (interactiv= e)
=A0=A0=A0 (save-excursion
=A0=A0=A0=A0=A0 (goto-char (point-max))<= br>=A0=A0=A0=A0=A0 (while (outline-previous-heading)
=A0=A0=A0=A0=A0=A0=A0 (when (and (org-entry-get (point) "reschedule&qu= ot;)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (equal "= ;TODO" (cdar (org-entry-properties)))
=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (> (string-to-number (format-time-string &qu= ot;%j")) (string-to-number (format-time-string "%j" (org-get= -scheduled-time (point))))))
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (org-todo "CANCELLED")))))
=A0 =A0 (global-set-key (kbd "s-f") 'fc/org-forward-task-if-not-= done)
#+END_SRC


When used on a task like this...
=
* TODO test
=A0 :PROPERTIES:
=A0 :reschedule: yes
=A0 :LOGGING: CANCELLED(!)
= =A0 :END:
=A0 SCHEDULED: <2013-10-24 jeu. ++1w>


...when I press <s-f>, the task is automatically scheduled to the n= ext thursday (from today) if it was not done starting from 2013-10-25.

Best regards,

FC

On Wed, Oct 23, 2013 at 3:37 PM, Fletch= er Charest <fletcher.charest@gmail.com> wrote:
Dear S=E9bastien,=

Thank you for your answer, it is useful. Now I can= see that I already worked on a task even if I reschedule it and don't = see the "Sched. 2x" mention. But I still have to manually resched= ule the task to the next week, which is what I *really* want to avoid, even= at the price of not seeing what I already did either in the form of clocki= ng time or with the "Sched. 2x" mention (maybe this wasn't cl= ear in my first message).

I will try to write something with my very poor level of emacs-lisp. My= reasoning would be something like: "if a task that has this particula= r property was scheduled for being done x days ago (with x > 0), and if = it is not marked DONE, then reschedule it (7 - x) days later". I could= maybe include a comment saying that this task was automatically reschedule= d, with a timestamp. I just hope I'm not reinventing the wheel somewher= e in that process.

Best regards

On Mon, Oct 21, 2013 at 9:15 PM, Sebastien Vau= ban <sva-news@mygooglest.com> wrote:
Hello Fletcher,

Fletcher Charest wrote:
> First of all, apologies if I'm doing something wrong - I'm not= used to
> posting in mailing lists.
>
> I read in the Org manual, about scheduled tasks :
>
> "A reminder that the scheduled date has passed will be present in= the
> compilation for today, until the entry is marked DONE, i.e., the task = will
> automatically be forwarded until completed."
>
> Sometimes, I schedule a task but can only carry out my second day of w= ork
> on that task one week later (or my first day if I couldn't work on= it on
> the scheduled day). I would like to know if it is possible to schedule= a
> task, for example, on a Sunday, and see it appear in the agenda the ne= xt
> Sunday with the mention "Sched. 2x: =A0TODO my task". This w= ay I know I have
> to carry out my second day of work on that task on that day.
>
> I tried to use delays for this but couldn't obtain anything.
>
> I'm sorry if this is standard functionality or if it has been answ= ered
> somewhere. I usually find all my answers about org-mode online but thi= s
> time I couldn't find any info.

This hasn't been answered yet, neither is it a common reque= st.

FWIW, I removed such scheduling info (2x, 3x...) because it scared me to he= ll
when it went over 99 days delay.

But, to answer you, no, I don't think it's doable in the current sy= stem.
Though, you could get more or less the same functionality by clocking time,=
rescheduling your task for the available Sunday, and clock again. On that d= ay,
you would see that you're clocking hours 8 to 15 of your work.

Best regards,
=A0 Seb

--
Sebastien Vauban




--047d7b3a8c305add9d04e9a1b706--