Hello,

Is there anything wrong with the patch or with the proposition of
adding a hook there? The first I'd like to know for doing better next
time (or maybe correcting this one), the second to know if  I should
stop using it.

Thanks!
Joris

Joris Caravati <tyx+...@sula.io> writes:

> Hello,
>
> I've been archiving tasks automatically using
> `org-after-todo-state-change-hook' but I've been recently bit with a
> note (entering a todo state configured with '@') being placed where the
> task was before its archival.
>
> This patch aims to offer a way to defer the archival after the
> note is stored. Actually, I am using it like this:
>
> #+begin_src elisp
> (add-to-list 'org-after-todo-state-change-hook
>        (lambda ()
>          ;; States configured without mandatory note
>          (when (member org-state '("DONE"))
>            (my/org-roam-archive-to-today))
>          ;; States configured with mandatory note
>          (when (member org-state '("CANCELLED" "READ"))
>            (add-to-list 'org-after-note-stored-hook 
> 'my/org-roam-archive-to-today))))
> #+end_src
>
> With `my/org-roam-archive-to-today' removing itself from
> `org-after-note-stored-hook'.
>
> Hopefully I did not miss an existing way to do this.
>
> Regards,
> Joris
>
> [2. text/x-patch; 0001-Add-org-after-note-stored-hook.patch]...

Reply via email to