[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org a3c912c 26/85: Fix duplicate logbook entry for repe
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org a3c912c 26/85: Fix duplicate logbook entry for repeated tasks |
Date: |
Mon, 27 Sep 2021 15:57:43 -0400 (EDT) |
branch: externals/org
commit a3c912cb299a90415028207eb4d78cf88b4880f3
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Bastien <bzg@gnu.org>
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.
* testing/lisp/test-org.el: Add test checking the reported bug.
[1]
https://orgmode.org/list/CAOn=hbcaW1R6vtun-E2r4LS=j3dp=VjqmjGtzy8UC1SyPArKbA@mail.gmail.com
---
lisp/org-agenda.el | 6 +++++-
lisp/org.el | 4 +---
testing/lisp/test-org.el | 23 ++++++++++++++++++++++-
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index aa46d5b..4ee3623 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9436,7 +9436,11 @@ the same tree node, and the headline of the tree node in
the Org file."
(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 4cd2118..e1780cf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10945,9 +10945,7 @@ EXTRA is additional text that will be inserted into the
notes buffer."
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."
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index f3a729b..160968c 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -7411,7 +7411,28 @@ Paragraph<point>"
SCHEDULED: <2012-03-29 Thu +2y>
CLOCK: [2012-03-29 Thu 10:00]--[2012-03-29 Thu 16:40] => 6:40"
(org-todo "DONE")
- (buffer-string))))))
+ (buffer-string)))))
+ ;; Make sure that logbook state change record does not get
+ ;; duplicated when `org-log-repeat' `org-log-done' are non-nil.
+ (should
+ (string-match-p
+ (rx "* TODO Read book
+SCHEDULED: <2021-06-16 Wed +1d>
+:PROPERTIES:
+:LAST_REPEAT:" (1+ nonl) "
+:END:
+- State \"DONE\" from \"TODO\"" (1+ nonl) buffer-end)
+ (let ((org-log-repeat 'time)
+ (org-todo-keywords '((sequence "TODO" "|" "DONE(d!)")))
+ (org-log-into-drawer nil))
+ (org-test-with-temp-text
+ "* TODO Read book
+SCHEDULED: <2021-06-15 Tue +1d>"
+ (org-todo "DONE")
+ (when (memq 'org-add-log-note post-command-hook)
+ (org-add-log-note))
+ (buffer-string))))))
+
;;; Timestamps API
- [elpa] externals/org d700c03 04/85: org-manual: Add referring to tables in other files, (continued)
- [elpa] externals/org d700c03 04/85: org-manual: Add referring to tables in other files, ELPA Syncer, 2021/09/27
- [elpa] externals/org d3d2e56 07/85: oc: Replace an obsolete alias, ELPA Syncer, 2021/09/27
- [elpa] externals/org 3a77e59 05/85: ox-ascii: Justify correctly with indent-tabs-mode, ELPA Syncer, 2021/09/27
- [elpa] externals/org 4271f22 10/85: org-manual: Undo the last change in Shakespeare's verse, ELPA Syncer, 2021/09/27
- [elpa] externals/org 7aeadf2 02/85: Backport commit 3f9f3ba43 from Emacs, ELPA Syncer, 2021/09/27
- [elpa] externals/org ef31364 03/85: ob-tangle: Fix incorrect buff name in org-src edit, ELPA Syncer, 2021/09/27
- [elpa] externals/org c9dc660 11/85: Fix org-babel-header-args:haskell not being an alist, ELPA Syncer, 2021/09/27
- [elpa] externals/org 527da79 18/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org e626185 23/85: org-table.el: Fix usage of user-error, ELPA Syncer, 2021/09/27
- [elpa] externals/org 179ae6b 25/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org a3c912c 26/85: Fix duplicate logbook entry for repeated tasks,
ELPA Syncer <=
- [elpa] externals/org 769a557 28/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 777c1c3 27/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 74a5af6 31/85: Fix byte-comp function warnings, ELPA Syncer, 2021/09/27
- [elpa] externals/org 4d1a77a 32/85: org-attach: Fix byte-comp function warning, ELPA Syncer, 2021/09/27
- [elpa] externals/org 18f6ef8 33/85: ox.el: add smart quotes for greek, ELPA Syncer, 2021/09/27
- [elpa] externals/org 1c83f6f 47/85: Allow sexps with nested parenthesis in org-agenda-prefix-format, ELPA Syncer, 2021/09/27
- [elpa] externals/org d3d80c5 46/85: Add test checking org-log-done specs, ELPA Syncer, 2021/09/27
- [elpa] externals/org df51e93 53/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 72c9f1b 43/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org acc49d5 41/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27