emacs-orgmode@gnu.org archives
 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: [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, 10 Jul 2021 21:48:08 +0800	[thread overview]
Message-ID: <87a6muwa93.fsf@localhost> (raw)
In-Reply-To: <CAOn=hbcaW1R6vtun-E2r4LS=j3dp=VjqmjGtzy8UC1SyPArKbA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

Bhavin Gandhi <bhavin7392@gmail.com> writes:

> I was able to reproduce this, and here are my findings as well as a
> reproducible configuration with only a few settings.

The breakage was introduced in commit c67037:

[c670379adfbdc4883d3cfa230289fd2829993265] Fix `org-agenda-todo' undo behavior when logging (not adding note)

The fix is attached.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-duplicate-logbook-entry-for-repeated-tasks.patch --]
[-- Type: text/x-diff, Size: 1353 bytes --]

From ff3c0f6524d4165518ec0c53b49a58162ff7b2a9 Mon Sep 17 00:00:00 2001
Message-Id: <ff3c0f6524d4165518ec0c53b49a58162ff7b2a9.1625924841.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sat, 10 Jul 2021 21:43:44 +0800
Subject: [PATCH] Fix duplicate logbook entry for repeated tasks

* lisp/org.el (org-add-log-setup): Always run `org-add-log-note' via
`post-command-hook'.  Otherwise, there is no way to know if a note was
requested for `this-command'.  Running `org-add-log-note' directly
would, for example, break `org-auto-repeat-maybe' as reported in [1].

[1] https://orgmode.org/list/CAOn=hbcaW1R6vtun-E2r4LS=j3dp=VjqmjGtzy8UC1SyPArKbA@mail.gmail.com
---
 lisp/org.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ffcc5945d..3d15771a2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10939,9 +10939,7 @@ (defun org-add-log-setup (&optional purpose state prev-state how extra)
 	org-log-note-extra extra
 	org-log-note-effective-time (org-current-effective-time)
         org-log-setup t)
-  (if (eq how 'note)
-      (add-hook 'post-command-hook 'org-add-log-note 'append)
-    (org-add-log-note purpose)))
+  (add-hook 'post-command-hook 'org-add-log-note 'append))
 
 (defun org-skip-over-state-notes ()
   "Skip past the list of State notes in an entry."
-- 
2.31.1


  parent reply	other threads:[~2021-07-10 13:48 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   ` Ihor Radchenko [this message]
2021-07-10 16:46     ` [PATCH] " 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               ` [PATCH] " Ihor Radchenko
2021-09-25 15:25             ` 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

  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=87a6muwa93.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 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).