emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ignacio Casso <ignaciocasso@hotmail.com>
To: emacs-orgmode@gnu.org
Subject: [BUG] Resolving idle clocks needs multiple keystrokes [9.5.2 (release_9.5.2-24-g668205 @ /home/ignacio/repos/emacs/lisp/org/)]
Date: Sat, 12 Mar 2022 12:07:09 +0100	[thread overview]
Message-ID: <PAXPR06MB776016FB8E72FC0A8A88A02CC60D9@PAXPR06MB7760.eurprd06.prod.outlook.com> (raw)

Hello,

> CONTEXT:  When I'm idling with the clock running, Org asks if I want
> to resolve the clock when I come back (this is by setting
> org-clock-idle-time).
> 
> PROBLEM: I'm not sure how recent the change was, but Org started
> asking me _multiple times_ what I want to do when back.

I have this problem, already reported but not solved in these threads
and maybe others:
https://lists.gnu.org/archive/html/emacs-orgmode/2019-02/msg00333.html,
https://lists.gnu.org/archive/html/emacs-orgmode/2010-08/msg00188.html.

I have investigated a little and it seems that there is a timer that
calls org-resolve-clocks-if-idle every minute, and if
(org-user-idle-seconds) is greater than 60*org-clock-idle-time, that
function prompts the user to resolve the clock. The problem is that this
prompt blocks Emacs, and if you are idle (org-clock-idle-time + N)
minutes, the other N scheduled calls to org-resolve-clocks-if-idle occur
immediately after answering the prompt. But for some reason (a bug?),
answering the prompt does not affect (org-user-idle-seconds), so the
prompt appears again, and you have to answer it N times (unless your
answer was to cancel the clock or clock out).

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.

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. 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.

What do yo think?



Emacs  : GNU Emacs 29.0.50 (build 9, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2022-03-11
Package: Org mode version 9.5.2 (release_9.5.2-24-g668205 @ /home/ignacio/repos/emacs/lisp/org/)


             reply	other threads:[~2022-03-12 14:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-12 11:07 Ignacio Casso [this message]
     [not found] <87sfrnqlbu.fsf@hotmail.com>
2022-03-13 20:42 ` Ignacio Casso
2022-03-19 10:07   ` Roméo La Spina
2022-03-19 11:08     ` Ignacio Casso
2022-03-19 12:29       ` Roméo La Spina
2022-03-20 12:21         ` Ignacio Casso
2022-03-20 21:02           ` Roméo La Spina

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.orgmode.org/

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

  git send-email \
    --in-reply-to=PAXPR06MB776016FB8E72FC0A8A88A02CC60D9@PAXPR06MB7760.eurprd06.prod.outlook.com \
    --to=ignaciocasso@hotmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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/org-mode.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).