Re: [PATCH] Re: Prompt when resolving clocks [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2022-10-08 Thread Ihor Radchenko
Roméo La Spina  writes:

> After some discussion on the subject on another topic (see 
> https://lists.gnu.org/archive/html/emacs-orgmode/2022-03/msg00233.html), I 
> have a small patch that prevents the prompt for disappearing on unwanted 
> events, using `read-char-exclusive'. You will find it enclosed.
> ...
> From 0078523a768f215d8053905f66266cb1d083a7cf Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Rom=C3=A9o=20La=20Spina?= 
> Date: Mon, 21 Mar 2022 20:00:43 +0100
> Subject: [PATCH] lisp/org-clock.el: Fix bug in prompt for resolving clocks

Thanks! And sorry for the late reply.

The patch looks good, especially since we are using
`read-char-exclusive' in most places already.

Applied onto main with minor amendment to the commit message (I added a
link to this thread).
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=de553d1dc7c587d1f3a853543259f8a14464af54

You are also now listed as a contributor at 
https://orgmode.org/worg/contributors.html

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[PATCH] Re: Prompt when resolving clocks [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2022-03-21 Thread Roméo La Spina
Hello,

After some discussion on the subject on another topic (see 
https://lists.gnu.org/archive/html/emacs-orgmode/2022-03/msg00233.html), I have 
a small patch that prevents the prompt for disappearing on unwanted events, 
using `read-char-exclusive'. You will find it enclosed.

Regards,
Romeo

>From 0078523a768f215d8053905f66266cb1d083a7cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rom=C3=A9o=20La=20Spina?= 
Date: Mon, 21 Mar 2022 20:00:43 +0100
Subject: [PATCH] lisp/org-clock.el: Fix bug in prompt for resolving clocks

* lisp/org-clock.el (org-clock-resolve):
Avoid unwanted disappearing of the prompt when clicking somewhere, by
using `read-char-exclusive' instead of `read-char'.

TINYCHANGE
---
 lisp/org-clock.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 6f441c18e..f7d25599c 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1099,9 +1099,9 @@ to be CLOCKED OUT."
 		?j ?J ?i ?q ?t ?T)))
 (or (ding) t)))
 		  (setq char-pressed
-			(read-char (concat (funcall prompt-fn clock)
-	   " [jkKtTgGSscCiq]? ")
-   nil 45)))
+			(read-char-exclusive (concat (funcall prompt-fn clock)
+	 " [jkKtTgGSscCiq]? ")
+ nil 45)))
 		(and (not (memq char-pressed '(?i ?q))) char-pressed)
 	 (default
 	   (floor (org-time-convert-to-integer (time-since last-valid))
-- 
2.35.1


Roméo La Spina  writes:

> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?  See
>
>  https://orgmode.org/manual/Feedback.html#Feedback
>
> Your bug report will be posted to the Org mailing list.
> 
>
> Hello,
>
> I have a little problem concerning org-clock.
> When resolving clocks, either because of a long idleness or because of
> dangling clocks, there is a prompt to ask the user if they want to keep
> idle time, substract it, etc...
> But when another event than the response occurs (typically, I come back
> to my computer, I don't see the prompt and I click somewhere), an
> exception "Non-character input event" is raised, and the prompt
> disappear, making it impossible to resolve the clock later.
>
> When googling the error message I saw that the problem might be due to
> the use of the function read-char when prompting the user, which is
> indeed used in the function that resolve clocks.
>
> Is there a solution to wait for the user to answer the prompt, like a
> classical yes-no prompt?
>
> Best regards,
>
> Romeo
>
> Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, 
> cairo version 1.17.4)
>  of 2021-03-26
> Package: Org mode version 9.4.4 (release_9.4.4 @ 
> /usr/share/emacs/27.2/lisp/org/)



Prompt when resolving clocks [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2022-02-22 Thread Roméo La Spina


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Hello,

I have a little problem concerning org-clock.
When resolving clocks, either because of a long idleness or because of
dangling clocks, there is a prompt to ask the user if they want to keep
idle time, substract it, etc...
But when another event than the response occurs (typically, I come back
to my computer, I don't see the prompt and I click somewhere), an
exception "Non-character input event" is raised, and the prompt
disappear, making it impossible to resolve the clock later.

When googling the error message I saw that the problem might be due to
the use of the function read-char when prompting the user, which is
indeed used in the function that resolve clocks.

Is there a solution to wait for the user to answer the prompt, like a
classical yes-no prompt?

Best regards,

Romeo

Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, 
cairo version 1.17.4)
 of 2021-03-26
Package: Org mode version 9.4.4 (release_9.4.4 @ 
/usr/share/emacs/27.2/lisp/org/)



Prompt when resolving clocks [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2022-02-22 Thread Roméo La Spina


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Hello,

I have a little problem concerning org-clock.
When resolving clocks, either because of a long idleness or because of
dangling clocks, there is a prompt to ask the user if they want to keep
idle time, substract it, etc...
But when another event than the response occurs (typically, I come back
to my computer, I don't see the prompt and I click somewhere), an
exception "Non-character input event" is raised, and the prompt
disappear, making it impossible to resolve the clock later.

When googling the error message I saw that the problem might be due to
the use of the function read-char when prompting the user, which is
indeed used in the function that resolve clocks.

Is there a solution to wait for the user to answer the prompt, like a
classical yes-no prompt?

Best regards,

Romeo

Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, 
cairo version 1.17.4)
 of 2021-03-26
Package: Org mode version 9.4.4 (release_9.4.4 @ 
/usr/share/emacs/27.2/lisp/org/)