Org-mode mailing list
 help / color / mirror / 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: Sun, 11 Jul 2021 09:29:45 +0800
Message-ID: <874kd1wsc6.fsf@localhost> (raw)
In-Reply-To: <CAOn=hbdOKhZbJobqAM-34VxNW3UfUAh+uEq4fsP-Oo5EU9K4kw@mail.gmail.com>

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

Bhavin Gandhi <bhavin7392@gmail.com> writes:

> Thank you! I tried the patch, but the original bug[1] which the commit
> `c67037' tried to fix, gets introduced again. Basically,
> `org-agenda-undo' just removes the logbook entry and the scheduled date
> remains new.

You are right. I believe that I fixed the breakage in the attached
patch. Also, I noticed that c67037 did not fix the original bug when
state change requests interactive note.

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: 2158 bytes --]

From f012648b350013e33ef0e88afc85b4fcf048734b Mon Sep 17 00:00:00 2001
Message-Id: <f012648b350013e33ef0e88afc85b4fcf048734b.1625966756.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].

* lisp/org-agenda.el (org-agenda-todo): Avoid reintroducing the bug
fixed in c670379adf.

[1] https://orgmode.org/list/CAOn=hbcaW1R6vtun-E2r4LS=j3dp=VjqmjGtzy8UC1SyPArKbA@mail.gmail.com
---
 lisp/org-agenda.el | 6 +++++-
 lisp/org.el        | 4 +---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 44acd035a..4cd527e5b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9433,7 +9433,11 @@ (defun org-agenda-todo (&optional arg)
 	 (goto-char pos)
 	 (org-show-context 'agenda)
 	 (let ((current-prefix-arg arg))
-	   (call-interactively 'org-todo))
+	   (call-interactively 'org-todo)
+           ;; Make sure that log is recorded in current undo.
+           (when (and org-log-setup
+                      (not (eq org-log-note-how 'note)))
+             (org-add-log-note)))
 	 (and (bolp) (forward-char 1))
 	 (setq newhead (org-get-heading))
 	 (when (and org-agenda-headline-snapshot-before-repeat
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


  reply	other threads:[~2021-07-11  1:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 13:39 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 [this message]
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

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://orgmode.org

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

  git send-email \
    --in-reply-to=874kd1wsc6.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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git