From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#54371: 29.0.50; read-char does not reset idle timer in some cases Date: Sun, 13 Mar 2022 12:08:53 +0200 Message-ID: <83sfrmkvuy.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7946"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54371@debbugs.gnu.org To: Ignacio Casso Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 13 11:10:26 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nTLBC-0001wj-18 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Mar 2022 11:10:26 +0100 Original-Received: from localhost ([::1]:38944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTLBB-0005Oo-5e for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Mar 2022 06:10:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTLAo-0005Of-8n for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2022 06:10:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nTLAn-0008AB-Vs for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2022 06:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nTLAn-0000QB-PL for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2022 06:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Mar 2022 10:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54371 X-GNU-PR-Package: emacs Original-Received: via spool by 54371-submit@debbugs.gnu.org id=B54371.16471661601552 (code B ref 54371); Sun, 13 Mar 2022 10:10:01 +0000 Original-Received: (at 54371) by debbugs.gnu.org; 13 Mar 2022 10:09:20 +0000 Original-Received: from localhost ([127.0.0.1]:41683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTLA8-0000Ox-8X for submit@debbugs.gnu.org; Sun, 13 Mar 2022 06:09:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTLA7-0000Ol-AE for 54371@debbugs.gnu.org; Sun, 13 Mar 2022 06:09:19 -0400 Original-Received: from [2001:470:142:3::e] (port=53176 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTL9y-00087C-Ev; Sun, 13 Mar 2022 06:09:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UKyyEhYcojY/7L7nh4siHz8TizB33Yr250sT9u7Pwbk=; b=sV4S7ByGJIZd iL032FE1aIwaHcj11AcORplh5fN0eoKZbI2hEM9BbJ6+GJrkZBbJeVBcbuP5uGYM7LPCeDOPiJ66N 5dI73I8bQWt90PTm2Xh89gtEqjzErF8bUYaNmZy7p6GMw6P50MIrnM/AAlXQB08Zqd4Edt5MN/U0t yz0dtheyW7DdSk7Aroid9bUN34dNL3/gH/NaF0QtX6Un+qI+QmGRTssUg2u+nssLDvj+/n6HGvZj+ jd7FH+KD0zJp+yh3fZm26ONM1ZjLZAdOxvGCOeic2oXphADDVSeKhtYbmORKf6leLCZTycNziY38T 1cF9++c5EMxQv8XVbgMqUQ==; Original-Received: from [87.69.77.57] (port=1599 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTL9x-0001MI-Rn; Sun, 13 Mar 2022 06:09:10 -0400 In-Reply-To: (message from Ignacio Casso on Sun, 13 Mar 2022 00:27:59 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:228291 Archived-At: > From: Ignacio Casso > Date: Sun, 13 Mar 2022 00:27:59 +0100 > > If I evaluate the following snippet, after 3 seconds Emacs prompts me > for a character and prints nil. > > (defun my-test () > (read-char "> " nil nil) > (message "%s" (current-idle-time))) > > (run-with-timer 3 nil 'my-test) > > However, if I evaluate the following snippet instead, where the last > argument of read-char is changed to the number of seconds the prompt > should wait at most for user input, it prints (0 K _ _), where K is 3 > seconds plus whatever time in seconds you took to answer the > prompt. This means that right after reading a character from user input > Emacs still thinks it has been idle for a while. > > (defun my-test () > (read-char "> " nil 10) > (message "%s" (current-idle-time))) > > (run-with-timer 3 nil 'my-test) > > This is the reason behind a bug that occurs when resolving the running > org clock after some idle time, for which I have seen reports more than > 10 years old but not as much discussion as I would expect. This makes me > think that Emacs does not behave like this for most systems and the > problem is particular to my setup. My setup should not be particular in > any sense however, just an Ubuntu 20.04 with default and standard > packages. Emacs' is the only configuration I have ever tweaked in my > machine, and this happens also with "emacs -Q", so it's not that. > > Can you please evaluate the second snippet to try to reproduce this in > your machine? I can reproduce this. However, it sounds like we do this on purpose, to avoid problems with idle timers that call sit-for. See the discussion that started here: https://lists.gnu.org/archive/html/emacs-devel/2006-08/msg00395.html The change installed at that time made read_char avoid restarting idle timers when it is called with a non-nil END_TIME argument.