From: Ihor Radchenko <yantar92@gmail.com>
To: Cletip Cletip <clement020302@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>,
Bhavin Gandhi <bhavin7392@gmail.com>
Subject: [BUG] Storing multiple log notes recursively only keeps the last note (was: Tracking todo state changes AND automatically change to done when all children are done)
Date: Sun, 02 Oct 2022 14:10:57 +0800 [thread overview]
Message-ID: <87edvq21se.fsf@localhost> (raw)
In-Reply-To: <87y1w4oxul.fsf@localhost>
Ihor Radchenko <yantar92@gmail.com> writes:
>> To reproduce this curious behavior, you only need this configuration:
>
> Confirmed.
>
> Something inside `org-todo' call in the hook triggers recursive-edit
> that, in turn, triggers premature call to post-command-hook containing
> note saving function.
I was wrong. Your bug has little to do with recursive edits.
It is related to the fact that log notes rely on global variables to
save the information about the note and record it in
`post-command-hook'.
What is happening is that `org-add-log-setup' is first called for the
child heading and then called for the parent heading in
`org-after-todo-statistics-hook'. The second call overwrites the global
note state.
Later, after Emacs finish executing the user command,
`org-store-log-note' is called, but it only sees the overwritten log
state - the one for the most recent call to `org-add-log-setup' (parent
heading). Thus only parent heading gets the actual note record.
We can solve the issue in multiple ways:
1. We may force recording the previous note (if any) at the beginning of
`org-add-log-setup'.
2. We may alter `org-add-log-setup' to record the note using recursive
edit. This way, every log note will be recorded immediately upon
request.
3. We may maintain a log queue and record multiple logs one-by-one in
post-command-hook.
I personally like option 2, but I am not sure about side effects.
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92
prev parent reply other threads:[~2022-10-02 6:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-04 14:27 Tracking todo state changes AND automatically change to done when all children are done Cletip Cletip
2022-08-04 15:02 ` Ihor Radchenko
2022-08-04 15:12 ` Cletip Cletip
2022-08-05 1:27 ` Ihor Radchenko
2022-08-05 2:11 ` Cletip Cletip
2022-08-05 2:28 ` Ihor Radchenko
2022-08-05 14:22 ` Cletip Cletip
2022-10-02 6:10 ` Ihor Radchenko [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=87edvq21se.fsf@localhost \
--to=yantar92@gmail.com \
--cc=bhavin7392@gmail.com \
--cc=clement020302@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).