emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Archiving repeated tasks under corresponding date tree for each repe


From: Ihor Radchenko
Subject: Re: Archiving repeated tasks under corresponding date tree for each repeated item
Date: Tue, 17 Nov 2020 23:59:37 +0800

> Now I get the error: "wrong number of arguments..." :D

It does not happen in my Emacs. It would be helpful if you shared the
whole error message.

I used the following code for testing:

(defun my/org-archive-without-delete ()
  "Archive item at point, but do not actually delete it."
  (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
    (org-archive-subtree)))
    
(defun org-archive-repeated-task (arg)
  "Add a copy of the recurring task marked DONE to archive."
  (when (and (eq (plist-get arg :type) 'todo-state-change)
             (string= (plist-get arg :to) "DONE")) ;; The state is changed to 
DONE
    (let* ((pos (plist-get arg :position))
           (repeater (org-with-point-at pos (org-get-repeat))))
      (when repeater ;; Only consider tasks with repeater timestamp anywhere in 
the task body
        (my/org-archive-without-delete)))))
        
(add-hook 'org-trigger-hook #'org-archive-repeated-task)

Best,
Ihor

Gerardo Moro <gerardomoro37@gmail.com> writes:

> Now I get the error: "wrong number of arguments..." :D
>
> El mar., 17 nov. 2020 a las 15:13, Ihor Radchenko (<yantar92@gmail.com>)
> escribió:
>
>> > I tried this but I get: "symbol's function definition is void:
>> >  org-trigger-doing"
>>
>> Oops. That's the old function name. Should be
>>
>> (add-hook 'org-trigger-hook #'org-archive-repeated-task)
>>
>> Best,
>> Ihor
>>
>>
>> Gerardo Moro <gerardomoro37@gmail.com> writes:
>>
>> > Thanks for the prompt reply!
>> > I tried this but I get: "symbol's function definition is void:
>> >  org-trigger-doing"
>> >
>> > El mar., 17 nov. 2020 a las 14:32, Ihor Radchenko (<yantar92@gmail.com>)
>> > escribió:
>> >
>> >> > Thanks, I don't know how to go about doing that, so I would have to
>> rely
>> >> on
>> >> > others wanting to help me if they consider this to be also useful to
>> them
>> >> > (which I definitely think it is!).
>> >>
>> >> Try the following code. It should archive any repeated task once it is
>> >> marked DONE.
>> >>
>> >> (defun org-archive-repeated-task (arg)
>> >>   "Add a copy of the recurring task marked DONE to archive."
>> >>   (when (and (eq (plist-get arg :type) 'todo-state-change)
>> >>              (string= (plist-get arg :to) "DONE")) ;; The state is
>> changed
>> >> to DONE
>> >>     (let* ((pos (plist-get arg :position))
>> >>            (repeater (org-with-point-at pos (org-get-repeat))))
>> >>       (when repeater ;; Only consider tasks with repeater timestamp
>> >> anywhere in the task body
>> >>         (my/org-archive-without-delete)))))
>> >> (add-hook 'org-trigger-hook #'org-trigger-doing)
>> >>
>> >> Best,
>> >> Ihor
>> >>
>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]