From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0I3iIw2yNWJxeQAAgWs5BA (envelope-from ) for ; Sat, 19 Mar 2022 11:35:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id wBOIHA2yNWJRXwEAG6o9tA (envelope-from ) for ; Sat, 19 Mar 2022 11:35:57 +0100 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 D800215BCC for ; Sat, 19 Mar 2022 11:35:56 +0100 (CET) Received: from localhost ([::1]:40956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVWRA-00049v-2g for larch@yhetil.org; Sat, 19 Mar 2022 06:35:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVWQM-00049g-Rg for emacs-orgmode@gnu.org; Sat, 19 Mar 2022 06:35:10 -0400 Received: from [2a00:1450:4864:20::335] (port=42544 helo=mail-wm1-x335.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVWQK-00009D-TK for emacs-orgmode@gnu.org; Sat, 19 Mar 2022 06:35:06 -0400 Received: by mail-wm1-x335.google.com with SMTP id r190-20020a1c2bc7000000b0038a1013241dso5983924wmr.1 for ; Sat, 19 Mar 2022 03:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=Vf6F519NdAJKm9K2GVjzqTzfD44M8SKWhl/B7lkDEhk=; b=JLJ07ui00Ll/5EREURxCDzgttPS9RQSnoZk3JQIhAGHxD/BfFm1L4ZG/zgH+ZDnG5G b8UMNztLjOnCBmjhgpAyGW9z2+8T7Wnrce3OaD54nIzL3N2CQ1QjQJk8lAqCWGsD2GM3 tfyrE6sSO1hDhTaGwKXeY6IHRnmw/qc9m1LdqKTSMi00yOIE9r6lAJEmf4a4b3kpFJUL rNY01uSKjWukC2grqJaxnOyZiDI1+V5BlYsBKBA1oRS20jBxnAq8gBRojkbmBSY+jMO0 pnrTwiCAHUzvybNACIvZFKuVqcbo86ynzUQCcTBP5R8gBMTob+mjxIXu4xNNrHF6FNtu 7DIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=Vf6F519NdAJKm9K2GVjzqTzfD44M8SKWhl/B7lkDEhk=; b=Q0zH9dbvUotIePxo1kcM65uLpXR+1c+b3muZw+mJA1yLPc0md6XAuvYAe2+sP6VGUn 61nno9PxPWUDs7HsidPa0mkfw5lQAKRtQ0MnQawSQeE0kMkak4th4qymvp68glvjgc3M 3sP9bxMgduxSP8ZQzK0IT+ZAY/eIsfGd9l1dlLIyh+m8xCZhyRxHBhRg44zyF6MyWRWs iaqz6WVWVtkwwUmFdzfJhebnKOX/xis87uBXYVJCBMPSaYpBFyee+/hx65JaF7mGcMKr xk3hncFsk1CK0oNPkMY0sw7nLRIO36/uF4k4Y+2ilHSmZsTzUDyhnDUBbzR44uxDio7g nQ1g== X-Gm-Message-State: AOAM53030if26k5Xrnlx+AjHncK3MMEPUUgkU42+6Qfvv5CLS1RU5+zE /iQu8lNLtNIsdXq1zjkIT1fQYEKRc7E= X-Google-Smtp-Source: ABdhPJw0zO5sJWfJsSO6mbFgfgf52UYAm47sx5puZLdnwuinQxQLn8SnjVPqkh+AajzLWVyacfJfug== X-Received: by 2002:a05:600c:a53:b0:38c:8722:9bd9 with SMTP id c19-20020a05600c0a5300b0038c87229bd9mr7141130wmq.179.1647686102459; Sat, 19 Mar 2022 03:35:02 -0700 (PDT) Received: from ARCH-RLS.gmail.com (2a01cb0890110e0095a3e704c498f8cb.ipv6.abo.wanadoo.fr. [2a01:cb08:9011:e00:95a3:e704:c498:f8cb]) by smtp.gmail.com with ESMTPSA id p125-20020a1c2983000000b00389cc36a3bfsm12337442wmp.6.2022.03.19.03.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Mar 2022 03:35:02 -0700 (PDT) References: <87sfrnqlbu.fsf@hotmail.com> User-agent: mu4e 1.6.10; emacs 27.2 From: =?utf-8?Q?Rom=C3=A9o?= La Spina To: Ignacio Casso Subject: Re: [BUG] Resolving idle clocks needs multiple keystrokes [9.5.2 (release_9.5.2-24-g668205 @ /home/ignacio/repos/emacs/lisp/org/)] Date: Sat, 19 Mar 2022 11:07:38 +0100 In-reply-to: Message-ID: <878rt6cjsa.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::335 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=romeo.laspina1@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1647686157; 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=Vf6F519NdAJKm9K2GVjzqTzfD44M8SKWhl/B7lkDEhk=; b=rgXejUfOsEx3xW/jzrmgcejORZQyfaYXe0BhjlzWq194ANCVf4EN2v49JAHRlmPIYXZM1m xIhw3iODBSpYIFHIgVN7gDyQRzongcijdahe1W5Nn2TnuB1ASi/A6hsQy9kkI3eYy11QWl usyTV93rIkCBvHhY+rTaqCFYLjtcVvZVGARjvyW03pwjNrOvbq8+pSXGq3yAvPJWGWx5gi ldzgJYR4hhWU5dYlms5IAFWO61LlDYBEs7sYuQ78iFYtKFcaKCzpatwWvhGWPvLMclQp9u mPuAdtwchCLCvK0Ex/8YG1bPYTFIP2eDw+HuA9RyJ+FSPkuDcLdL/rqh8IH4SQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647686157; a=rsa-sha256; cv=none; b=ROs43bNhm2d9hUFPxFQPNwy9uXEJRkkq9i633YnQVTvHGNFTCiY91jv2U0HrEbPiOjKXxz Af1O+Ft0cS6zGdT0kyeJmvMqb3Qri13pmrjpyFJRxYd+a75uxsVVsKrQYHAXi5VSwlhB77 FB2ofazTcgYjhsuQs44EOqFve5CWIUSleATbKz99BSz+epbDrTNDMKu3O1G4xLhUs0qK+D OZBCTl8YzHpx5hzDNsXku6pHIK8G+Bi3WRCNBqe1sN9DiF25ziiCGQi3XE2wrktA9Re0/V neJ8jDkd/GzfpHFNXi53MQkTX41bwTsx9umJ7sMk1GhV0HIEmMwD/GQ6H85SdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JLJ07ui0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -9.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JLJ07ui0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D800215BCC X-Spam-Score: -9.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2dPrEshVTbln Hi, I don't know how closely it is related to your problem, but I've reported another issue revolving around the use of read-char for the prompt to resolve clocks. See [[https://lists.gnu.org/archive/html/emacs-orgmode/2022-02/msg00278.html]]. Unfortunately I an not advanced enough in Elisp to know whether using another function than read-char would solve your problem as well as mine (maybe read-char-choice waits for a valid char, while resetting the idle timer ?), but it might be a hint. What do you think ? Regards, Romeo Ignacio Casso writes: >> So the problem is in (org-user-idle-seconds), which in my window system >> boils down to a call to (current-idle-time). It should return 0 after >> answering the prompt, but in my system it keeps counting up. At this >> point I stopped investigating since that function is defined in C. >> > > I have investigated this a little bit further and it seems that reading > a character with read-char only resets the idle timer if the SECONDS > argument is nil (which is not the case here) . I reported it as a bug to > bug-gnu-emacs@gnu.org, but it seems there is a reason for that. See > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54371 > >> Since this bug is already old and I have not found much information >> about it, I assume that in most systems answering the prompt does reset >> the idle timer and this bug does not occur. > > It also seems to happen for all systems, so either much less people than > I thought use this feature, or there is something else that makes this > bug particular to my setup, although I can't think of anything else. > >> As a quick fix for those >> systems where this is an issue, we could reset the idle timer ourselves >> after the prompt in org-resolve-clocks-if-idle. > > I have thought of a better way to fix this, and currently there is no > way to do reset the idle timer with Elisp anyway. I attach the patch: it > just cancels the timer before prompting the user and sets it again if > needed after the prompt is answered. What do you think? > > [2. Patch for org-resolve-clocks-if-idle bug --- text/x-diff; 0001-fixed-bug.patch] > From 288b25ea95699596762b199088ce6828a5e9a0ed Mon Sep 17 00:00:00 2001 > From: Ignacio > Date: Sun, 13 Mar 2022 21:41:43 +0100 > Subject: [PATCH] fixed bug > > --- > lisp/org/org-clock.el | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el > index dce5d9d4c0..81d4a85782 100644 > --- a/lisp/org/org-clock.el > +++ b/lisp/org/org-clock.el > @@ -1228,7 +1228,9 @@ org-resolve-clocks-if-idle > (org-clock-user-idle-start > (org-time-since org-clock-user-idle-seconds)) > (org-clock-resolving-clocks-due-to-idleness t)) > - (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) > + (when (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) > + (cancel-timer org-clock-idle-timer) > + (setq org-clock-idle-timer nil) > (org-clock-resolve > (cons org-clock-marker > org-clock-start-time) > @@ -1237,7 +1239,10 @@ org-resolve-clocks-if-idle > (/ (float-time > (time-since org-clock-user-idle-start)) > 60))) > - org-clock-user-idle-start))))) > + org-clock-user-idle-start) > + (when (and (org-clocking-p) (not org-clock-idle-timer)) > + (setq org-clock-idle-timer > + (run-with-timer 60 60 #'org-resolve-clocks-if-idle))))))) > > (defvar org-clock-current-task nil "Task currently clocked in.") > (defvar org-clock-out-time nil) ; store the time of the last clock-out