From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kLRVARMiM2IUcgAAgWs5BA (envelope-from ) for ; Thu, 17 Mar 2022 12:57:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YJpSOhIiM2J5hQAA9RJhRA (envelope-from ) for ; Thu, 17 Mar 2022 12:57:06 +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 793DDA1ED for ; Thu, 17 Mar 2022 12:57:06 +0100 (CET) Received: from localhost ([::1]:50616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUoka-0006yP-Rh for larch@yhetil.org; Thu, 17 Mar 2022 07:57:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUogX-00048h-P1 for emacs-orgmode@gnu.org; Thu, 17 Mar 2022 07:52:53 -0400 Received: from mail-oln040092070061.outbound.protection.outlook.com ([40.92.70.61]:37799 helo=EUR03-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUogT-00064x-LL for emacs-orgmode@gnu.org; Thu, 17 Mar 2022 07:52:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gLZqeOJaokkiLdM8NDEjKj+WMdDEqcWNcEdPW6sCA7ps4HwdqQVNyxsmQ8AhREuEEfUAPsocfoMY8iGMFU/z+lpbgWduHFewm4BUZl5FBNMtAw/7NuJQpIKxpRZCNJIUWM/EQEhRyk+gB3QaPo9dHQ8j0p6q5HZrYAbUkB7fKFt2YrMJ7VsvQuN9yW0Ewk3Y1ash87TJq8/ygzCOwOxTzgVK25saVblu1mPYiMEBtg42Pj2ElNeSheXaAZ22EANcrJ+EY7p+7Sd+lvL9bVFikwqBkWo9DXz5AGtLF2xp2a0W1dJT3Vxd01Tci1j0AJ/MRxw9IZkSOiL4JS1dzSsU7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AhY+KQvNSZk/NNucD2NJW56KtyNHVCXgmG6GVpgZD7k=; b=kg9gWp8Ci7byKpc8F3hElv3TrFwi9lC9vNBwYJR6aIeontzUDNB0ohzPhjsgtiz0FpO5NSxP++wxItAHoGw2ppqg3fOj/4EaAP5K04PhKnQpIMHI2/vEsGQLj5+KrpLBhqugGk/gdD5CRBRd6u7YHzZiG0OsWHRWItAwXNQgqRGHNOzqiqtNBGjLaEBWrPkHd+yBnqVO4nacIK5gA5zWD3FlFKJJYsUfb+o+1Na3WlOwxlz/T/IRfSenBg88EaEXJshkym6ukBPuZN8bUqZsFO/chaQqRPbx25sLsvezpgyVlduueg4AY0gGmLyT4Ze3K8ulwI3MzLacXtApcyOttQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AhY+KQvNSZk/NNucD2NJW56KtyNHVCXgmG6GVpgZD7k=; b=FAqBZuwrNsT6cDRGlRi3W4hTICu30fiKxJEW9eYy+fjZqH5Nr8/ZKwZzdJmivTrRvCEvy/j/DYPTgSwlriZ4SBqr7lnLkgaw23sT3IJuacuR8cxN7Whaed+1B85SweYgCnJJSi5LYYHyLWomnVBNte6dtP/f8aSBwJC9w5KPVXURglAAtzv1chvgFoFU+/51BckPbiNYs5BW4D57lDvRornQt/VO5iXX5p4LmFARrUh5WG2xJ0ycDoZv4t4GtNM+fHFMblLstj/VXJugcko8GM7yRlMqhw+1vJX9h0pi88ASdHSxUyfn2wQ7Rr1bQIGw/dve7TtzYVk2hKzSuzZ0sA== Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by VI1PR06MB6606.eurprd06.prod.outlook.com (2603:10a6:800:185::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Thu, 17 Mar 2022 11:52:47 +0000 Received: from PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::e05a:8d81:8648:b10f]) by PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::e05a:8d81:8648:b10f%9]) with mapi id 15.20.5081.017; Thu, 17 Mar 2022 11:52:46 +0000 User-agent: mu4e 1.6.10; emacs 27.2 From: Ignacio Casso To: emacs-orgmode@gnu.org Subject: [PATCH] Fix for bug that makes the user have to answer the prompt more than once for resolving running clock after being idle Date: Thu, 17 Mar 2022 12:22:43 +0100 Message-ID: Content-Type: multipart/mixed; boundary="=-=-=" X-TMN: [iPC7HEeC8B2PLgufAG2wM72RRMHDSZg3] X-ClientProxiedBy: MRXP264CA0027.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:14::15) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <87h77wssmq.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb40242a-afb3-4a71-a99f-08da080ca704 X-MS-TrafficTypeDiagnostic: VI1PR06MB6606:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wstpaBwekrQCQ5FmUYSS3+V/8b9V9Vb0yd0wcLBQ2NFFk8z6Aou3mpY2O1VIkFN2nHUwVVpIXA+Vmjs3BPg9avfsCBOPI39fYYryoWbllBn3SX0eAcOHhCMO6lgCwYmiZOqmR+LayWU54iYMyiC5yGmsmPyLrobTxq3a3eiBCfCzoHDz3LV1PxWYabkla03Iv4reI6RdIr8JqW55zJqp5yEQbSSvZr5Qm5ptRuzwNi87sJkpa9NbKCJ7kDltSiqYTOD3cHyVCHgwAiZhPFuR/fmjegFFzQ+aTvD+gImQUqA4DhKII6F4cd9ElJClc2qcUyVejbdFtgRvYXekTT8axJLI5V25PtLrXi3a95QacwPIhG3i0NSTR8r/ogksJ7maSZxUI/HPELGgHIQWWeFZoKrKLt9ezX8vzNCY7DB1GEovHlsHwHicGsqhxRyF8PWu2gtOaB74G1LejFfr4eV/gTSgNAWX78soLp0gNZgqFoO5cEoK2riy0J2T/Q7fv2aFvaB1j6R2h5fXWFzvU0SuiXcJYTitVEnQqInSqyPoNen5S4CE1SPzeJXTjqX/rM8VeJ6cMpc/gjLTueujJcg6pB7DEOzNL9/uYLTylGHE6b5iQcCJ2kNPX2rfLk1+4rD0yXu/gcB+ryBwSsk8dTj/3hvHS/AfaA29XeHdnHYUP/s= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BmGzd10yuVQsQGNT4AHeRJzS0gm+8jcF0OIyrVAt8NpAxZBo0gmjZe7nD4uh?= =?us-ascii?Q?LBmIh8gtPATpGzRcNuXmHOKi7nEULVxAPA+bO6lHeDAF5heghO8CaOFh0Yt3?= =?us-ascii?Q?kfwsXMw2VquhGfwgHFJX2cghtD9q4hY754A5eK1fSMzg2yQRQ2BtQ4xP4KP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Ex1fhr8XmmWXor8FMBgstGCW7FzjWC9VfsXGbHps?= =?us-ascii?Q?EjxOCB0+kR+zalhkvaewEC6gtveQJnnlLH839O+1dvh/qXU5y7v4ASdcUFEw?= =?us-ascii?Q?aRYsFZCTuWJO8EHJLAJMNPaHZ7Qp2Zf+bg=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: bb40242a-afb3-4a71-a99f-08da080ca704 X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 11:52:46.9370 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR06MB6606 Received-SPF: pass client-ip=40.92.70.61; envelope-from=ignaciocasso@hotmail.com; helo=EUR03-AM5-obe.outbound.protection.outlook.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , 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=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1647518226; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=AhY+KQvNSZk/NNucD2NJW56KtyNHVCXgmG6GVpgZD7k=; b=i/zC38K6CEXDi72Wl5mV/+7y4+bMj90FNHVVYe1fiHdLq1fceZDbQbzA8SYJpPdxCRDjSX jHImLh8ZCm4I1d4qSsUHQLKZm8mfwDBNG0z7bt2BxuF0CYjE70Cn7Az2Dh796MkIJFVDAm PlNDNSxv8ykCAJEn/cOur+nQ9kwJR3qYWYvsfeFI16/5lDmPFmVkAnIzbqPdXv3AYRfxBB BHqpBaubFBgkIm0rvMJfOmL6wyK0eTC/8pGo1EUv4gSh2EEOy+PzlMtq8YB5fGccHqJBcY q5oZ+vfy8nQchY0FDKfmrCRTog2vztF+D8f+PXqAn9qiK1XsGBPusCW5snF22w== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1647518226; a=rsa-sha256; cv=pass; b=VOs0D8hKQCpjnF4jjC5leOf9VxWc+lT0rHLhYkoftIOqkdqLa8QQ6JQMQzHTC0M9pBTzZX Rhc9HeCZC9Ez9xyO/PSv1REtLwkg22EYPApvk104KuoBZ3SWZUXpfgMmbVRoSLUZ+Zntfb l9JcQbawU4jrvB5topFv2PIL47AqkJhcU/1LEZjSQkU7ycVMDqZ+jO9zB3OyXg3j2zVVBT Iq9EOs6rziDJOJ9hFJKBbwqYKumq0vryQPPkeXsvk7u/l8tSWbq8OniqDH/02XlZC+NlQJ vLLq5B8cQV58Dbxekm6t/mPeHNH7s163IaJ2e7o4rf8fhy40XHiwhMx5RjoEEQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=FAqBZuwr; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.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: -5.16 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=FAqBZuwr; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.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: 793DDA1ED X-Spam-Score: -5.16 X-Migadu-Scanner: scn1.migadu.com X-TUID: eMUMgyu1x9n/ --=-=-= Content-Type: text/plain Hello, I have fixed the bug reported in https://lists.gnu.org/archive/html/emacs-orgmode/2010-08/msg00188.html, https://lists.gnu.org/archive/html/emacs-orgmode/2019-02/msg00333.html, and https://lists.gnu.org/archive/html/emacs-orgmode/2022-03/msg00127.html. In the last of those threads (two emails) I explained in detail the bug and the reason it happens. Here is the patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-clock.el-resolve-running-clock-after-being-idle-.patch Content-Description: Bug fix >From bb4c9e0836b039a496a033a002d97d7062bd8dc8 Mon Sep 17 00:00:00 2001 From: Ignacio Date: Thu, 17 Mar 2022 11:50:44 +0100 Subject: [PATCH] org-clock.el: resolve running clock after being idle only once * lisp/org-clock.el (org-resolve-clocks-if-idle): Cancel timer for `org-resolve-clocks-if-idle' while `org-clock-resolve' waits for the user to answer the prompt. After the user answered the prompt to resolve the running clock, the pending scheduled calls to `org-resolve-clocks-if-idle' (one for each minute it took the user to answer) were being executed immediately. But after an old change in Emacs, the user answer does not reset the idle timer anymore, so each of those calls thought that the user was still idle and prompted them again, to the user had to answer the same prompt again N times. This commit fixes that bug. TINYCHANGE --- lisp/org-clock.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 6f441c18e..83e6dd319 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1231,7 +1231,9 @@ so long." (org-clock-user-idle-start (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) @@ -1240,7 +1242,10 @@ so long." (/ (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 -- 2.25.1 --=-=-=--