emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] Add org-after-note-stored-hook


From: Joris Caravati
Subject: Re: [PATCH] Add org-after-note-stored-hook
Date: Sun, 12 May 2024 22:12:41 +0200
User-agent: mu4e 1.12.4; emacs 29.3

Ihor Radchenko <yantar92@posteo.net> writes:
> Although, removing heading from inside
> `org-after-todo-state-change-hook' is a bad idea - Org mode does not
> expect the heading to disappear from under the cursor when this hook is
> executed. I recommend using `org-trigger-hook' instead.

Thanks for your help! I switched to `org-trigger-hook' without issue.

> An easier way would be forcing note earlier by calling
> `org-add-log-note' from your hook.

I remember trying that before adding the hook (and I tried again today)
but the problem with adding the note directly is that I only seem to
manage storing the note where the task was before being archived,
eg. with this (or any variants I could think of while making sense of
what note functions do):

#+begin_src elisp
  (when (member (plist-get properties ':to) '("CANCELLED" "READ"))
    (org-add-log-note)
    (my/org-roam-archive-to-today))
#+end_src

which I find logical, since `org-store-log-note' is only called after
=C-c C-c= is pressed, whereas the archival function is called just after
the note buffer is created. So I still struggle to see how I could do
without the hook (maybe if the archival function would return the
position of the task after moving it, but that seems more complicated
than just using the hook).

> It will probably be better to run such new hooks right before (message "Note 
> stored")
> in `org-store-log-note'.

A patch modified to match the suggested location for the `run-hooks' is
attached.

Attachment: 0001-lisp-org.el-Add-org-after-note-stored-hook.patch
Description: Text Data


reply via email to

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