emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] Re: Bug: Duplicate logbook entry for repeated tasks [9.4.6 (


From: Ihor Radchenko
Subject: Re: [PATCH] Re: Bug: Duplicate logbook entry for repeated tasks [9.4.6 (9.4.6-gab9f2a @ /home/gustavo/.emacs.d/elpa/org-9.4.6/)]
Date: Sat, 17 Jul 2021 21:41:28 +0800

Bhavin Gandhi <bhavin7392@gmail.com> writes:

> I was trying to understand your change. So, when we call
> `org-agenda-todo', it calls `org-todo' which adds the
> post-command-hook. This hook is supposed to run when `org-agenda-todo'
> finishes, but instead of that we call it directly. This makes sure that
> the change is recorded in `buffer-undo-list'.

You are almost correct. To be able to use undo from agenda, we must have
all the changes happen inside org-with-remote-undo body. Only then the
changes are recorded into agenda's buffer `buffer-undo-list'.
post-command-hook, if ran after `org-agenda-todo', will only record
changes in the actual org buffer's `buffer-undo-list', but not inside
the agenda's `buffer-undo-list'.

> Sorry if that's too much to ask, but why don't we need something similar
> when org-log-note-how is 'note?  Can you please help me understand that?
> I tried reading org-add-log-note and org-store-log-note, but I think I'm
> missing something basic here.

AFAIK, it is quite hard to do with current log note implementation.
`org-add-log-note' itself does not record the note text. Instead, it
only creates and pre-populates the note buffer and returns the control
to the function calling `org-add-log-note'. Regardless where we call
`org-add-log-note', the actual note text will only be added to the org
buffer when the user presses C-c C-c in the note buffer. And the user
input will only be possible after the current command (in our case
`org-agenda-todo') finishes. Thus, user note will always be added
outside `org-with-remote-undo' and cannot be recorded by agenda.

IMHO, the proper way to handle this would be rewriting the log-note code
using recursive editing. But that's not a trivial change and should be
implemented in a separate patch.

> Also, should this line from org.el (org-store-log-note) be removed?
>
>   ;; Don't add undo information when called from `org-agenda-todo'.

I think so. It appears to be irrelevant to current state of the code.
Someone forgot to remove this comment in one of the past patches. But
removing the comment should be a separate patch itself.

Best,
Ihor



reply via email to

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