From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CEtEInqb1mCmmQAAgWs5BA (envelope-from ) for ; Sat, 26 Jun 2021 05:14:02 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id QLLvHXqb1mAOVAAAbx9fmQ (envelope-from ) for ; Sat, 26 Jun 2021 03:14:02 +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 A5C589F84 for ; Sat, 26 Jun 2021 05:14:01 +0200 (CEST) Received: from localhost ([::1]:51582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwylb-0000wW-PI for larch@yhetil.org; Fri, 25 Jun 2021 23:13:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwylE-0000vs-IT for emacs-orgmode@gnu.org; Fri, 25 Jun 2021 23:13:36 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:41837) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwylA-0001VK-VZ for emacs-orgmode@gnu.org; Fri, 25 Jun 2021 23:13:36 -0400 Received: by mail-lf1-x131.google.com with SMTP id j4so19714963lfc.8 for ; Fri, 25 Jun 2021 20:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JwoTyQkjJXypgw+AKbWNkrAfYhJ7yNpur31QPlqjGjY=; b=Dkzcja4zvaP2FZKxjgHj6B4VVVNlhscNNuOeAVNon0CbvwG1Y+Ewhn0/yKfSlgUEP2 dNdtbfvJkpPDALwYJ102R2h+grfniSqvjW++f6Y42NxBKjNQcJYL4LA2Nl6Cs4fm+YQT rVgllScozgG+e/ds8unE4M5PjkNuw64e/QBocnwQbKdASKA9sYGMJ60O9qqjDKZqc7JY aGKrKOJNwq6HiBRnmffwjqCOGSm12nOGnHgBWG6wf89wM7ZTONM4Wo4YaG2Yxip8jSuP bj5gBdESj6+5ge63KLMbhi8kRQII/rakGJt68UAU3ajz3hNJs7F7WKKGBkbkU4muwDVf xh1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JwoTyQkjJXypgw+AKbWNkrAfYhJ7yNpur31QPlqjGjY=; b=GRK87G03Alh0SP0bOLGO2b+AQ9yuGeSRNIuSwulNynDgh7I2EBROHG0iSRc1doI5Tt GsA7wN/BDV+u2WstyjC8J89Q3ApHWonUeHLwGIB0z+N+gE2d4zqmBOMbdyvsyMSKxmRz pWTnbuhdTQJk3SJCt98uWchVeLE2e0UnhoHHUyGa5Tp43P9zVLiia2fHsZqwVl6WPSSB lvIiwAW4iH0O/7XR+nK2tF66aiKNwaewv1kqL28BBo7goErbdLFHxSppZmBP7nFs3ktE kVvck8EN8Qx7IAYJDzIiVgwfIJRENBUZfyn6R5cSqDVMK/TVYzYKiANqZwdJSWc7vPC+ cqIA== X-Gm-Message-State: AOAM530piRzofjNUqBdPbIK7AT/13CatujL/buZTiaovVYBQLPmktcVT voLEv0RzVelfMc7hNyVbyQ4XX8fhhYwIsEG4Ix0= X-Google-Smtp-Source: ABdhPJzYFrR4E3HNeScGfNmd3JHvwSf9W1FLAuwXwHJj8ULIYDNjlB/YSMP8EJRUy0nJ5LPAsE5CFmoU7ml7tt1vgf0= X-Received: by 2002:a19:ab19:: with SMTP id u25mr10097710lfe.570.1624677210029; Fri, 25 Jun 2021 20:13:30 -0700 (PDT) MIME-Version: 1.0 References: <87fsxgd420.fsf@gmail.com> In-Reply-To: <87fsxgd420.fsf@gmail.com> From: Jeff Kowalski Date: Fri, 25 Jun 2021 20:13:18 -0700 Message-ID: Subject: Re: Bug: Duplicate logbook entry for repeated tasks [9.4.6 (9.4.6-gab9f2a @ /home/gustavo/.emacs.d/elpa/org-9.4.6/)] To: Gustavo Barros Content-Type: multipart/alternative; boundary="000000000000fa826805c5a2a38e" Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=jeff.kowalski@gmail.com; helo=mail-lf1-x131.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, HTML_MESSAGE=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, bhavin7392@gmail.com 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=1624677241; 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=JwoTyQkjJXypgw+AKbWNkrAfYhJ7yNpur31QPlqjGjY=; b=Ss9SaKUzFeilIeDb3HeTuAZR9pBXCyJpdQ1bzNAqxUL+cDmhvvCe51hbCr7OB1L0I03qYe 7UWvpA5iaV/Q5J/hncbVqvct6EBjBGnqZ0S+BS3bh2sPQhBp5FPxBZSaccqpel8lliiogR 3XYYK6Tqhr90xzs/92qcYRUg/4h87b6/LhkqKyw6T4x14b43O79OnBoZtFa2XgCM9YLsdP H7iMM8qLSqiRnzxUCvzmUkxhqMgi1aOwFdvJaukfE0opYs5Eec183ejrYHTC3vPHqEOzc+ wk/6gcQ4YAOAkqPhRFEQGBl2cqolpF1knyWkbu8Je4udVwsBgihYrXCUe35HRA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624677241; a=rsa-sha256; cv=none; b=IyQ4TLqZ9qDzC2zFl4NW3GpinCkKGvEJW6M5+crRoDFA7rAYVbDR+O/CAV3INA/5TARtkL pG4QFWd4hdg83VwxvylwMRKR0E7nCufNo5iIs97Skk5Vci3vRk6LMNs2x9i2RWgR9sv3Jb uYOoqgsLA9ECM1os49FRKlXdBxjzKJJKpJxTV6UoJ28mxN9bFbfdHfpsNvyYlRLZNRcyxk 26CRUxhcKBEIfIoHFAjqN36lddgSeb1hRrleS1otIRAOXym5RVAqryWPGedUKKaGycbhtB gFQVe69ulfS2X3N/iHp1U7LVK23AGly+AVipVOIJLHdsaU826UywIqPmSARyTA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Dkzcja4z; 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: -1.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Dkzcja4z; 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: A5C589F84 X-Spam-Score: -1.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: EImUW2YErkjo --000000000000fa826805c5a2a38e Content-Type: text/plain; charset="UTF-8" While I don't have a fix for the root issue, I did have a chance to create a lint for LOGBOOK duplicates, as you suggested. It can be found here: https://github.com/jeffkowalski/prelude/commit/f44b6041730469ba2094849b60d301cd94a5bed1#diff-3de035eea502a119bcdd40f4adc3d6108d4f337f827358cb2361623525682042R1199-R1251 Also below: (defun jeff/org-logbook-retrieve-timestamps (beg end) "Retrieve timestamp of all state-change entries between BEG and END." (save-excursion (let* ((reversed org-log-states-order-reversed) (search (if reversed 're-search-forward 're-search-backward)) (limit (if reversed end (point))) (re (format "^[ \t]*-[ \t]+\\(?:State \"%s\"\s+from\s+\"%s\".*%s%s\\)" org-todo-regexp org-todo-regexp org-ts-regexp-inactive (let ((value (cdr (assq 'done org-log-note-headings)))) (if (not value) "" (concat "\\|" (org-replace-escapes (regexp-quote value) `(("%d" . ,org-ts-regexp-inactive) ("%D" . ,org-ts-regexp) ("%s" . "\"\\S-+\"") ("%S" . "\"\\S-+\"") ("%t" . ,org-ts-regexp-inactive) ("%T" . ,org-ts-regexp) ("%u" . ".*?") ("%U" . ".*?")))))))) log-entries) (goto-char (if reversed beg end)) (while (funcall search re limit t) (push (match-string-no-properties 3) log-entries)) log-entries))) (defun org-lint-duplicate-logbook-timestamps (ast) "Report LOGBOOK entries with duplicate timestamp" (org-element-map ast 'drawer (lambda (d) (when (equal (org-element-property :drawer-name d) "LOGBOOK") (let* ((beg (org-element-property :contents-begin d)) (end (org-element-property :contents-end d)) (orig (jeff/org-logbook-retrieve-timestamps beg end)) (uniq (cl-remove-duplicates orig :test (lambda (x y) (or (null y) (equal x y))) :from-end t)) (diff (- (length orig) (length uniq)))) (unless (zerop diff) (list (org-element-property :begin d) (format "LOGBOOK has %d entries with duplicate timestamp" diff)))))))) (add-to-list 'org-lint--checkers (make-org-lint-checker :name 'duplicate-logbook-timestamps :description "Report LOGBOOK entries with duplicate timestamp" :categories '(properties))) On Thu, Jun 17, 2021 at 6:16 AM Gustavo Barros wrote: > Thanks for confirming and for the habits info. So that's what was > happening with my consistency graphs. I had indeed been noticing they > felt "off", but I eventually reverted to 9.4.4 because of the duplicate > entries and forgot about it. It seems then that this got solved for me > not by the reverting itself but by me removing the duplicate entries in > the LOGBOOK. > > Would clocking reports be affected too? (I'm not personally an user of > clocking, so I don't really know). > > Perhaps a "lint" for LOGBOOK duplicates would be a good idea alongside > with the fix, so that people could go about fixing their data with a > little more convenience? > > Best regards, > Gustavo. > --000000000000fa826805c5a2a38e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
While I don't have a fix for the root= issue, I did have a chance to create a lint for LOGBOOK duplicates, as you= suggested.
It can be found here:

Also below:

=C2=A0 (defun jeff/org-logbook-retrieve-timestamps (beg e= nd)
=C2=A0 =C2=A0 "Retrieve timestamp of all state-change entries b= etween BEG and END."
=C2=A0 =C2=A0 (save-excursion
=C2=A0 =C2=A0= =C2=A0 (let* ((reversed org-log-states-order-reversed)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(search (if reversed 're-search-forwa= rd 're-search-backward))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(limit (if reversed end (point)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(re (format
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 "^[ \t]*-[ \t]+\\(?:State \"%s\"\s+from= \s+\"%s\".*%s%s\\)"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 org-todo-regexp
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 org-todo-regexp
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 org-ts-regexp-inactive
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((value (cdr (= assq 'done org-log-note-headings))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (not value) ""
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= concat "\\|"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-replace-escape= s
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(regexp-quote value)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0`(("%d" . ,org-ts-regexp-inactive)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("%D" . ,org-ts-rege= xp)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("%s" . "= ;\"\\S-+\"")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0("%S" . "\"\\S-+\"")
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0("%t" . ,org-ts-regexp-inactive)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("%T" . ,org-ts-rege= xp)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("%u" . "= ;.*?")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("%U" = . ".*?"))))))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0log-entries)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char (if reversed beg = end))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (while (funcall search re limit t)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (push (match-string-no-properties 3) log= -entries))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 log-entries)))

=C2=A0 (def= un org-lint-duplicate-logbook-timestamps (ast)
=C2=A0 =C2=A0 "Repor= t LOGBOOK entries with duplicate timestamp"
=C2=A0 =C2=A0 (org-elem= ent-map ast 'drawer
=C2=A0 =C2=A0 =C2=A0 (lambda (d)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 (when (equal (org-element-property :drawer-name d) "= LOGBOOK")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let* ((beg (org-eleme= nt-property :contents-begin d))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(end (org-element-property :contents-end d))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(orig (jeff/org-= logbook-retrieve-timestamps beg end))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0(uniq (cl-remove-duplicates
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 orig<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 :test (lambda (x y) (or (null y) (equal x y)))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 := from-end t))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(diff (- (length orig) (length uniq))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (unless (zerop diff)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (list (org-element-property :begin d)
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format "LOGBOOK has= %d entries with duplicate timestamp" diff))))))))

=C2=A0 (add-= to-list 'org-lint--checkers
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(make-org-lint-checker
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 :name 'duplicate-logbook-timestamps
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :description "Report = LOGBOOK entries with duplicate timestamp"
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :categories '(properties)))


On Thu, Jun 17, 2021 at 6:16 AM Gustavo Barros <gusbrs.2016@gmail.com> wrote:
Thanks for confirming and for the habits info.=C2=A0 So that's what was=
happening with my consistency graphs.=C2=A0 I had indeed been noticing they=
felt "off", but I eventually reverted to 9.4.4 because of the dup= licate
entries and forgot about it.=C2=A0 It seems then that this got solved for m= e
not by the reverting itself but by me removing the duplicate entries in the LOGBOOK.

Would clocking reports be affected too? (I'm not personally an user of =
clocking, so I don't really know).

Perhaps a "lint" for LOGBOOK duplicates would be a good idea alon= gside
with the fix, so that people could go about fixing their data with a
little more convenience?

Best regards,
Gustavo.
--000000000000fa826805c5a2a38e--