Re: [O] Org mode repeated dates to do spaced learning

2019-01-07 Thread Marcin Borkowski


On 2019-01-06, at 18:17, Andrea Giugliano  wrote:

> Hi there,
>
> That was a very helpful suggestion. At the bottom of the mail I attached

Glad to have helped!

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: [O] Org mode repeated dates to do spaced learning

2019-01-06 Thread Andrea Giugliano
Hi there,

That was a very helpful suggestion. At the bottom of the mail I attached
my first (working) stab at it.

The idea is to have an headline with the :spaced: tag and another tag
maintaining the number of repetition performed so far. At the beginning
I was thinking to use scheduled times instead of a "counter" tag, but it
was not worth the complexity of the code.

If anybody else finds this feature useful, what would be the best way
to share this?

#+begin_src elisp
(defun my/space-repeat-if-tag-spaced (e)
  "Resets the header on the TODO states and increases the scheduled date
according to a suggested spaced repetition interval."
  (let* ((spaced-rep-map '((0 . "++1d")
  (1 . "++2d")
  (2 . "++10d")
  (3 . "++30d")
  (4 . "++60d")
  (5 . "++4m")))
 (spaced-key "spaced")
 (tags (org-get-tags nil t))
 (spaced-todo-p (member spaced-key tags))
 (repetition-n (first (cdr spaced-todo-p)))
 (n+1 (if repetition-n (+ 1 (string-to-number (substring repetition-n 
(- (length repetition-n) 1) (length repetition-n 0))
 (spaced-repetition-p (alist-get n+1 spaced-rep-map))
 (new-repetition-tag (concat "repetition" (number-to-string n+1)))
 (new-tags (reverse (if repetition-n
(seq-reduce
 (lambda (a x) (if (string-equal x 
repetition-n) (cons new-repetition-tag a) (cons x a)))
 tags
 '())
  (seq-reduce
   (lambda (a x) (if (string-equal x spaced-key) 
(cons new-repetition-tag (cons x a)) (cons x a)))
   tags
   '())
(if (and spaced-todo-p spaced-repetition-p)
  (progn
  ;; avoid infinitive looping
  (remove-hook 'org-trigger-hook 'my/space-repeat-if-tag-spaced)
  ;; reset to previous state
  (org-call-with-arg 'org-todo 'left)
  ;; schedule to next spaced repetition
  (org-schedule nil (alist-get n+1 spaced-rep-map))
  ;; rewrite local tags
  (org-set-tags new-tags)
  (add-hook 'org-trigger-hook 'my/space-repeat-if-tag-spaced))
)))

(add-hook 'org-trigger-hook 'my/space-repeat-if-tag-spaced)
#+end_src


Thanks,

Andrea




On Wed 02 Jan 2019 at 05:59, Marcin Borkowski  wrote:

> On 2019-01-01, at 17:34, Andrea Giugliano  wrote:
>
>> Hi,
>>
>> Thanks for your reply. You are right org-drill does spaced repetition. I
>> just was unclear: I would like to see that in the agenda as a normal
>> item (that gets space-repeated every time I mark it DONE though).
>> I could not get from the docs if org-drill does that.
>
> That is an interesting idea.  I am pretty sure you could make it happen
> with `org-trigger-hook' or `org-after-todo-state-change-hook' (I am not
> entirely sure why both exist, btw).
>
>> Thanks,
>>
>> Andrea
>
> Hth,



Re: [O] Org mode repeated dates to do spaced learning

2019-01-01 Thread Marcin Borkowski


On 2019-01-01, at 17:34, Andrea Giugliano  wrote:

> Hi,
>
> Thanks for your reply. You are right org-drill does spaced repetition. I
> just was unclear: I would like to see that in the agenda as a normal
> item (that gets space-repeated every time I mark it DONE though).
> I could not get from the docs if org-drill does that.

That is an interesting idea.  I am pretty sure you could make it happen
with `org-trigger-hook' or `org-after-todo-state-change-hook' (I am not
entirely sure why both exist, btw).

> Thanks,
>
> Andrea

Hth,

--
Marcin Borkowski
http://mbork.pl



Re: [O] Org mode repeated dates to do spaced learning

2019-01-01 Thread Andrea Giugliano
Hi,

Thanks for your reply. You are right org-drill does spaced repetition. I
just was unclear: I would like to see that in the agenda as a normal
item (that gets space-repeated every time I mark it DONE though).
I could not get from the docs if org-drill does that.

Thanks,

Andrea

On Tue 01 Jan 2019 at 16:39, Bingo  wrote:

> Le 1 janvier 2019 18:02:31 GMT+05:30, Andrea Giugliano  a 
> écrit :
>>Happy 2019 everyone!
>>
>>I would like to slightly change my learning method this year. I have
>>heard that spaced learning is much better than bang your head against
>>the same material multiple times in a row.
>>
>>Spaced learning is simply reviewing some interesting topic at given
>>intervals: after 1 day, 1 week, 2 weeks, 1 month, 3 months, etc...
>>
>>It seems to me that org-mode does not support this: how would you make
>>a
>>repetitive task with spaced intervals?
>>
>>I saw org-drill.el, but I do not think it does this.
>>Ideally I could do something like:
>>
>>""
>>* review this interesting thing
>>SCHEDULED: <2019-01-01 Tue>
>>:PROPERTIES:
>>:SPACED:
>>:END:
>>""
>>
>>If this is not an interesting use case for org-mode, what do you think
>>about me trying to extend org-habits.el instead?
>>
>>Best wishes to all the community,
>>
>>Andrea
>
> Hi,
>Why do you think org-drill doesn't do spaced repetition ? I used it for a 
> while in 2017, and it does. I've since moved to Anki on Android phone for the 
> same purpose, because phones are accessible for longer, but was happy with 
> org-drill.


Re: [O] Org mode repeated dates to do spaced learning

2019-01-01 Thread Bingo
Le 1 janvier 2019 18:02:31 GMT+05:30, Andrea Giugliano  a 
écrit :
>Happy 2019 everyone!
>
>I would like to slightly change my learning method this year. I have
>heard that spaced learning is much better than bang your head against
>the same material multiple times in a row.
>
>Spaced learning is simply reviewing some interesting topic at given
>intervals: after 1 day, 1 week, 2 weeks, 1 month, 3 months, etc...
>
>It seems to me that org-mode does not support this: how would you make
>a
>repetitive task with spaced intervals?
>
>I saw org-drill.el, but I do not think it does this.
>Ideally I could do something like:
>
>""
>* review this interesting thing
>SCHEDULED: <2019-01-01 Tue>
>:PROPERTIES:
>:SPACED:
>:END:
>""
>
>If this is not an interesting use case for org-mode, what do you think
>about me trying to extend org-habits.el instead?
>
>Best wishes to all the community,
>
>Andrea

Hi,
   Why do you think org-drill doesn't do spaced repetition ? I used it for a 
while in 2017, and it does. I've since moved to Anki on Android phone for the 
same purpose, because phones are accessible for longer, but was happy with 
org-drill.




[O] Org mode repeated dates to do spaced learning

2019-01-01 Thread Andrea Giugliano
Happy 2019 everyone!

I would like to slightly change my learning method this year. I have
heard that spaced learning is much better than bang your head against
the same material multiple times in a row.

Spaced learning is simply reviewing some interesting topic at given
intervals: after 1 day, 1 week, 2 weeks, 1 month, 3 months, etc...

It seems to me that org-mode does not support this: how would you make a
repetitive task with spaced intervals?

I saw org-drill.el, but I do not think it does this.
Ideally I could do something like:

""
* review this interesting thing
SCHEDULED: <2019-01-01 Tue>
:PROPERTIES:
:SPACED:
:END:
""

If this is not an interesting use case for org-mode, what do you think
about me trying to extend org-habits.el instead?

Best wishes to all the community,

Andrea