emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Fletcher Charest <fletcher.charest@gmail.com>
To: Sebastien Vauban <sva-news@mygooglest.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Custom forwarding for a scheduled task
Date: Sat, 26 Oct 2013 11:44:41 +0200	[thread overview]
Message-ID: <CAGk6a7=Y1bcyi_wPv-grdJS42cTDOLASugozcdZ0OqxyryKtYg@mail.gmail.com> (raw)
In-Reply-To: <CAGk6a7=oZuZ38KZAcNYGeGiyW01ekQHeHbUM2po77RFVKnKjnw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4328 bytes --]

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 <s-f>, 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ébastien,
>
> 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 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 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, with
> 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 <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
>> 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 next
>> > 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 this
>> > 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 that
>> day,
>> you would see that you're clocking hours 8 to 15 of your work.
>>
>> Best regards,
>>   Seb
>>
>> --
>> Sebastien Vauban
>>
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 5583 bytes --]

      reply	other threads:[~2013-10-26  9:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 16:23 Custom forwarding for a scheduled task Fletcher Charest
2013-10-21 19:15 ` Sebastien Vauban
2013-10-23 13:37   ` Fletcher Charest
2013-10-26  9:44     ` Fletcher Charest [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='CAGk6a7=Y1bcyi_wPv-grdJS42cTDOLASugozcdZ0OqxyryKtYg@mail.gmail.com' \
    --to=fletcher.charest@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=sva-news@mygooglest.com \
    /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).