unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ignacio Casso <ignaciocasso@hotmail.com>
Cc: 54371@debbugs.gnu.org
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	[thread overview]
Message-ID: <83sfrmkvuy.fsf@gnu.org> (raw)
In-Reply-To: <PAXPR06MB776083EAD7BCD8C4B7C05F62C60E9@PAXPR06MB7760.eurprd06.prod.outlook.com> (message from Ignacio Casso on Sun, 13 Mar 2022 00:27:59 +0100)

> From: Ignacio Casso <ignaciocasso@hotmail.com>
> 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.





  reply	other threads:[~2022-03-13 10:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-12 23:27 bug#54371: 29.0.50; read-char does not reset idle timer in some cases Ignacio Casso
2022-03-13 10:08 ` Eli Zaretskii [this message]
2022-03-13 10:48   ` Ignacio Casso
2022-03-13 15:02     ` Lars Ingebrigtsen
2022-03-13 16:43       ` Eli Zaretskii
2022-03-13 17:45         ` Ignacio Casso
2022-03-13 19:34           ` Eli Zaretskii
2022-03-13 21:58             ` Ignacio Casso
2022-04-01 18:22               ` Ignacio Casso
2022-04-01 19:36                 ` Eli Zaretskii
2022-04-07 11:42                   ` Ignacio Casso
2022-04-08  6:50                     ` Eli Zaretskii
2022-04-11  6:42                       ` Ignacio Casso
2022-04-11 11:17                         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83sfrmkvuy.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=54371@debbugs.gnu.org \
    --cc=ignaciocasso@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).