From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +CLQI8RJ6mC+8gAAgWs5BA (envelope-from ) for ; Sun, 11 Jul 2021 03:30:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +GKKH8RJ6mCVDwAAB5/wlQ (envelope-from ) for ; Sun, 11 Jul 2021 01:30:44 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ACBF61EEA7 for ; Sun, 11 Jul 2021 03:30:43 +0200 (CEST) Received: from localhost ([::1]:60184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2OIr-0003m3-CH for larch@yhetil.org; Sat, 10 Jul 2021 21:30:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2OHy-0003lo-I9 for emacs-orgmode@gnu.org; Sat, 10 Jul 2021 21:29:46 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]:41591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2OHw-0007mS-L1 for emacs-orgmode@gnu.org; Sat, 10 Jul 2021 21:29:46 -0400 Received: by mail-lj1-x22c.google.com with SMTP id e20so15831833ljn.8 for ; Sat, 10 Jul 2021 18:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:cc:date:message-id :mime-version; bh=x/k93nosKc5qA4XaOARjGNp49tyJcH7ozEe4aZ21gNo=; b=Q9K5pdCQkKniezD0m9mgRIpp8iiBUk/CW6/7QoATXod3NIpDv++YNsxVGRJ0YyCT0P LwT7hcQuGRBMgUy2ftrUYjlFNDPj9A23xPiTN+NYt24lwlJB/PhRAwpDoGXsLSSL3DKI rV9jd/VUJJW6YXGhbkJX3eC1r75wLc5YPvQNt8K2lj8t5GMpxmRup2SZ/+ca3hmrAg7y OXxQ4KZIjumcnEknho86lHD0kPiUDCoEV0AN/dsbiI/8KSuM2jn4RGnc46Jyyvtw9B4m aFilmUge4ta0I1TjksO7V9FmCJ/nB8y8v9PVGcJqgY0U8Bq8vyiRKiw96his4d9l+cE9 CTGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:cc:date :message-id:mime-version; bh=x/k93nosKc5qA4XaOARjGNp49tyJcH7ozEe4aZ21gNo=; b=U9Ynr+E/pJ5u7UOJS6qhvpk3o+0NSkufPIDONg4bICmnCrV/6fHtfp2s3GHTjUlyCN 4YlAH1XldJJXnrf4BaSpsef0RExuBqiY8zsnpTibvuAYA0wtH1qnkI5Q01NTRHrLdFTV f4sUGD3FLP5W7I0L9DN/tFqdDPbjKMwl5Tlqz65jjAjI1nG9/3LHuQWbTAB5L3MG3T/g JBTSj+hm0U1aIXlPY7K08vZO89SFzYXdC6OxYCnMp62krD3wm6twr3bB8bjF14HX7Cov sxSM1DPI1xCsuf3G3VN/zfBGze2ugcVpEohd7QPBgeGpvSbwfq6LJHtyDEv8dczV59BQ dgIg== X-Gm-Message-State: AOAM531knwwwbPwPggot6nOrUIYkoxR7aBFpwUe6U83GXKGVsVDP6hcG YSAD7Q4N95LkQrNBl42h6YE= X-Google-Smtp-Source: ABdhPJxq+fId0XqUqb5rkkm6RSMpe23KN9c67U7cK0dGK/pFoaed3556Wk3zEVG5U7QsqlnmHp+JYA== X-Received: by 2002:a05:651c:544:: with SMTP id q4mr35726037ljp.105.1625966982766; Sat, 10 Jul 2021 18:29:42 -0700 (PDT) Received: from localhost ([158.255.2.9]) by smtp.gmail.com with ESMTPSA id o20sm825383lfk.252.2021.07.10.18.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jul 2021 18:29:42 -0700 (PDT) From: Ihor Radchenko To: Bhavin Gandhi 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/)] In-Reply-To: References: <877diwbm6a.fsf@gmail.com> <87a6muwa93.fsf@localhost> Date: Sun, 11 Jul 2021 09:29:45 +0800 Message-ID: <874kd1wsc6.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=yantar92@gmail.com; helo=mail-lj1-x22c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org, Gustavo Barros Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625967044; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=x/k93nosKc5qA4XaOARjGNp49tyJcH7ozEe4aZ21gNo=; b=IT1JxQ6/HvBfHlBbnM4d+dUU0cCHJdnaF2ZR0k5PJNCRJwE945hsgfiS2a5NsnqGCAr/Ha +PbZ5ocJPW9hddFdBtQi5aS7oBTQ6MrUesz4CC0dH/bjyC6wfpi2ybOe89M0Xavb1KVDTA PhM4P9ankFOZIbExhE4kbWfMX6ggqDZfOV7SGx+YrG6Jt7vwafSmqWuQciepmkcx0vR+vW n5ehwmk4uc/OsFr1Y+sQtrWDDVbGqX48NDX5Oy8+vjua4DeAy3lDeunQalwwbKB7GEUcR7 +wwaZS8BSP7R2cwDEQH1WCSeN6v+YajV/2744EJh6BLijinRWUB70Yyc9umsDQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625967044; a=rsa-sha256; cv=none; b=B+l4gvE94YIILhWUssIs374OzJWF2kJKLEZrsh016yFMirsVBcsfYvcrHcRj64iKNWx5OA T31c8DKqLqCTnvSiRZvMkJuI+jFWDROFolR0775qqxlh9nxmGQtDruqwW2gvLe+kOj6b5S jsLHolamLY17BwU36bWb2In8k0HYlJlSCcZM8PB7s86wjO0nRFOz34gBRO0iMg86NRGChv wVIxxjgj9DFjviWXknT23iPcE4j0fNNMJbDaHZAq2DWFvRO06ZM5Ox5DP2UQIK009jXXcW EaNQGm/mAdLeRdRjOVB9VHIBQ/7Lf9T12J0aqYThLCc7jgmesdM0MbvulIFoRg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Q9K5pdCQ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -0.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Q9K5pdCQ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: ACBF61EEA7 X-Spam-Score: -0.81 X-Migadu-Scanner: scn1.migadu.com X-TUID: Nl3GCTVR3HSX --=-=-= Content-Type: text/plain Bhavin Gandhi 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-duplicate-logbook-entry-for-repeated-tasks.patch >From f012648b350013e33ef0e88afc85b4fcf048734b Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko 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 --=-=-=--