all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Bhavin Gandhi <bhavin7392@gmail.com>
Cc: emacs-orgmode@gnu.org, Gustavo Barros <gusbrs.2016@gmail.com>
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	[thread overview]
Message-ID: <87lf656os7.fsf@localhost> (raw)
In-Reply-To: <CAOn=hbcMR5pBYGViXEtAiYZTWWLscs37bFLw7w+rApFGG1EeWQ@mail.gmail.com>

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


  parent reply	other threads:[~2021-07-17 13:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 13:39 Bug: Duplicate logbook entry for repeated tasks [9.4.6 (9.4.6-gab9f2a @ /home/gustavo/.emacs.d/elpa/org-9.4.6/)] Gustavo Barros
2021-06-14 18:01 ` Bhavin Gandhi
2021-06-14 18:41   ` Gustavo Barros
2021-07-10 13:48   ` [PATCH] " Ihor Radchenko
2021-07-10 16:46     ` Gustavo Barros
2021-07-10 17:14     ` Bhavin Gandhi
2021-07-11  1:29       ` Ihor Radchenko
2021-07-11  5:40         ` Ihor Radchenko
2021-07-11  5:57           ` Ihor Radchenko
2021-07-12 17:50             ` Bhavin Gandhi
2021-07-13  2:55               ` [PATCH] " Carlo Tambuatco
2021-07-13 15:35                 ` Alan Ristow
2021-07-13 18:08                   ` Bhavin Gandhi
2021-07-17 13:51                   ` Ihor Radchenko
2021-07-17 13:41               ` Ihor Radchenko [this message]
2021-09-25 15:25             ` [PATCH] " Bastien
2021-09-25 18:15               ` Gustavo Barros
2021-09-26  6:26     ` Bastien

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf656os7.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=bhavin7392@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gusbrs.2016@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.