From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KEnVE+hhLmJ0JgEAgWs5BA (envelope-from ) for ; Sun, 13 Mar 2022 22:28:08 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sKtIEOhhLmLSUwAAauVa8A (envelope-from ) for ; Sun, 13 Mar 2022 22:28:08 +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 AB8D03B56A for ; Sun, 13 Mar 2022 22:28:07 +0100 (CET) Received: from localhost ([::1]:41318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTVl0-0006AC-Dt for larch@yhetil.org; Sun, 13 Mar 2022 17:28:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTVkT-0006A2-B7 for emacs-orgmode@gnu.org; Sun, 13 Mar 2022 17:27:33 -0400 Received: from mail-oln040092064030.outbound.protection.outlook.com ([40.92.64.30]:30878 helo=EUR01-DB5-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 1nTVkQ-0003Qy-Tf for emacs-orgmode@gnu.org; Sun, 13 Mar 2022 17:27:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n10IqLsUR3pOlzkid1uvcYCPOy5I5l88hhAzNkPW7mB9Fb9rHrkZ/y1D4fAbs8Zd/hBFJhuvnZJyIr7CHAzQIX2mV67vFVwsgaKxmod0VsgRzgaJhv90D/p185mxp2CuSxh2g7Xxud2zfuJl5GWT7hGrn//Y6IM619dOawIIU80c4/LSEDGLIn9YoZ2s6izrmgKlFHPdI7fprhQyeuRew7bhTJuBTbP5VvBhXMbtYrSH4aeUWSa3Acft5CFduqG7xZyN1mTJOeUJ7EiMV9ggpSxYd5T4aPpWgJ2U9js8bJxJsE4iZnkfJeM9YUIEsm6TOCWuktDymsaP8hT612PX3g== 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=s7hvTFS5wfkdg0X/I5bnmd/kmnjmjdzQsWH37A4r35Q=; b=adrxZmcSCp/Zge88P8Kr3YMILmBgJlvTbnmHcDjL/pbOrQrFwqGJwO5mX76POqDTDRNDnR6wPLuCcGUMwm8lLDCe0nP/PQQM4tez9j7YC/WiiyNfKO0jCiDmftMKREw5xRGTXelnoMDhxLdv1N7qjVAiJc2NIBBWlSTIveY/Y6OSbVnhAU5bQb9wDdq1h5/3giSTE6YjdvBWxr5VJ0wpwQ70Hb8OXTxrOL90p8VEI88qZ+MK8xm6orS4z1HTt/H2Nt3uMaJrOD8AmcD0Hdevr/eX2JgWe1j9iCAu540VExfYCj8G3+iThXOYl0SfvcGEiQ0KegmdrXl/eogin9LnWA== 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=s7hvTFS5wfkdg0X/I5bnmd/kmnjmjdzQsWH37A4r35Q=; b=J+tpwrxamd8yVXCFFMP30eE1XH05qezAWWeXsr9AUETu5wOLTJZET3iSTWVphfqLzT3lmzsFVb7zs2nZ1d0qmW2kn7LsBFgRWUDfz1/SO/9vi6lo9Bj3NkdBSg1NYjZQyxjIfh6xykhkl/nbg00jwpK7YDo4llH58KADUBZ1GAG6xEilQWP4WJXNW0tNg6+vGDTsvsxd1sQeC/7XntRlniZ7KNk3YhO/+vq9K6wkj1PBSNByJTRaHJsOvl12GtB0oqj0EXXBNK+jG6DJWcRSbx72JKFbgC2fJ3jJW0qn0qaF9SvHNUkA7pMztVRSCZV8uVKFAbXiMWF4lwjmGpGqbQ== Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by AM0PR06MB6339.eurprd06.prod.outlook.com (2603:10a6:208:175::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Sun, 13 Mar 2022 21:27:27 +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.5061.026; Sun, 13 Mar 2022 21:27:27 +0000 References: <87sfrnqlbu.fsf@hotmail.com> User-agent: mu4e 1.6.10; emacs 29.0.50 From: Ignacio Casso To: emacs-orgmode@gnu.org 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: Sun, 13 Mar 2022 21:42:27 +0100 In-reply-to: <87sfrnqlbu.fsf@hotmail.com> Message-ID: Content-Type: multipart/mixed; boundary="=-=-=" X-TMN: [w9voPZx4kE1h4ufK6ckaOWOC2K9bu+fV] X-ClientProxiedBy: MR2P264CA0126.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:30::18) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <87a6dt35mu.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00b43d6c-288a-413e-6b71-08da053845e6 X-MS-TrafficTypeDiagnostic: AM0PR06MB6339:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kd6GsOwWTQGruNQ4P47ICBD7zOWSuKjpv44WHe+WwwvT4dG0aHSTqoy0DjtZbrWeWnxqpH1Sm3GNaAc4P7HDdZNsDI0dCy0lU9LgupHd2t4AezBUUxxVNWmLzwWvf0HAln3tDvhr2Wh9pxFTBjNTMIfzPZyr+DTpS+tzHwDK1+lHkMGdvjVFkC2U6UWcmtph3tu2VsUgPqnbHvv/5GxccbSOTSbKHBkGJrXKZOzL+oucrLm03zFMyE6nhK4eq6S+qMPdCol2s5O/pt5V2nFoFxDJmII3+sJJ0MywecqEEGuCUStLqPxNRp7lUujYwcnkwFV6oHLIwKFinysGdpC6CHYhrmCllTDxwFqu4b6Quinekj5VwqhEbRM5VFvpUbzEGZCj7vjcb/9kj0mFJbvm1KRDC85rTIHxbNmrWyed6TR1Ak/XpV/Wg/biMTqBF1SvccE4m2N0CCAePYFBAmH1pa0ibbzdoBnUYltQsFsi4fZfKg9DebLOvMO8MIssYZN1j8bt4Ia7lpnxPx95HuII9aeew/629tQ48NjdnC4l3IfF0l3NwvrFCJkd9qyAp8gJJRl/XAZCHdvp7VRqFor4jbmMvFe4ZeoHwW5xhu3fKIvK+rA5cA+0/hh1eE7R9nlp X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QpvBtQVSXVZujllIfZD7ZgZ5KfEIOybUegVH+OjAicYakurO50G4jB31Hvrp?= =?us-ascii?Q?F8V6oODQH/U5M46o+XqbTkB16U4cToug4kQWYfMOA4emq7hPNGipz0lqgNW7?= =?us-ascii?Q?vp4u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CQtjirVcP3?= =?us-ascii?Q?ljSqNE0yy97mjQ4vfI4+FEwjZ6R3m1BnkpwtTO8D6MPuB0p7wW+cLUq8EK4Z?= =?us-ascii?Q?RfOihWE6yIwmsgdXt5d71SLAXji0QFDTBXmm5ySLspJqkMdtYvBr0UYie5YA?= =?us-ascii?Q?8fDsddtaAbV9Ss8wcBrWmseaDEBhcCk0bmyT6NSCVXm5QkcVWKSBxH4=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 00b43d6c-288a-413e-6b71-08da053845e6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2022 21:27:27.8663 (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: AM0PR06MB6339 Received-SPF: pass client-ip=40.92.64.30; envelope-from=ignaciocasso@hotmail.com; helo=EUR01-DB5-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=1647206887; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=s7hvTFS5wfkdg0X/I5bnmd/kmnjmjdzQsWH37A4r35Q=; b=TAr59g5ejdg3t1m3ENsr8FNf8Tlk0uue6+9cUMB3zw+8GFU69yVUnv4xma8zJJL6v32L9G oFojjBFFT+FiYiZCgCiRuwh27shnm9iC8DnPRHbnHQnJbOLrKXy52Oele5eyaU5bdX02wS dqmqENv0CoGwXBtvU7hbdT0bNzdSiQqXJ1k+5KURbQ/+IDhhmaAmWXuR+mORe9G4wQJ/Vn bVWJTGsEqD14EPAXpos+mMYLozIrUDrOrr3MNrorWNtEgzAEWH1vHm9NufKqjPju3QVRlz BlhA6InzCiHiCGGJkt1mUiFgQLMXQ0TUrDdDqpmRKJgbu6tqx9eTKjprUQTtvQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1647206887; a=rsa-sha256; cv=pass; b=pbdgImNA6FLWr3xFeaa2ozW2SQ8QrHwbAdpOWTo2K0htAPbRzTuyk+v2zfkpLhGHL8ejsG WmsqPVYWzLdpGc9GTgvDFx9dr0V1ZdJ+1H2UViw79ICgqWaGkBtJn+hYwCcaPBXkgkYznL Y6s/tkkjaOs+/4A6FYaTswCZZrts74Ozl4XloCxRWvpEPd2DMaQ8XZAqxUMLSY8ZFAS8NG BBaf5vMHcI0d3hYsHKe0Y9DOxyU7R6KchuD7MhyI235ltSOK4++5hNsGVpTeOV5kRwC6/l cyrkyyRhCuAz57zMFSaPR27wD+Ec5+hAdEST3cx9SXmQU/kx7H+JdRHVZYPL3Q== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=J+tpwrxa; 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: -10.27 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=J+tpwrxa; 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: AB8D03B56A X-Spam-Score: -10.27 X-Migadu-Scanner: scn0.migadu.com X-TUID: KasMATKZOjVM --=-=-= Content-Type: text/plain > 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-fixed-bug.patch Content-Description: Patch for org-resolve-clocks-if-idle bug >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 -- 2.25.1 --=-=-=--