* Bug: Reclocking errors out if org-log-note-clock-out is t [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)]
@ 2021-05-30 0:53 Jorge P. de Morais Neto
2021-05-30 1:39 ` Jorge P. de Morais Neto
2021-05-31 13:43 ` Ihor Radchenko
0 siblings, 2 replies; 5+ messages in thread
From: Jorge P. de Morais Neto @ 2021-05-30 0:53 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Elisp to reproduce the bug --]
[-- Type: application/emacs-lisp, Size: 317 bytes --]
[-- Attachment #2: Type: text/plain, Size: 1966 bytes --]
Hi. I use Emacs from Guix---package emacs-next installed from Git
master (through --with-branch=emacs-next=master) and updated weekly.
Org is also from Guix: packages emacs-org{,-contrib,-drill,-pdftools}
To reproduce the bug, save the attached file¹ then invoke:
emacs -q -l /PATH/TO/org-log-note-clock-out--bug.el --batch
- Expected behavior: Org should clock in the first heading, then clock
out from it, prompt for a note, and clock in the second heading (in
batch mode, Emacs should print some clocking messages and then exit
successfully).
- What happens: Org errors out:
user-error: Before first headline at position 164 in buffer *Org Note*
I stepped through the code and verified the error is triggered at line
1726 on file org-clock.el. This is the form
(org-back-to-heading t)
on function `org-clock-remove-empty-clock-drawer'. That function runs
as a hook because of line 1717 on file `org-clock.el':
(run-hooks 'org-clock-out-hook)
on function `org-clock-out'.
Then using git-bisect, I have determined the bug was introduced on
commit c670379adfbdc4883d3cfa230289fd2829993265. I am sorry for not
providing a patch.
As a temporary workaround, I have erased my customization of
`org-log-note-clock-out'.
Regards
¹ Do you prefer this kind of small file to be attached to the mail
message as I have done here or should I have included it in the mail
body?
Emacs : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
Package: Org mode version 9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)
--
- <https://stallmansupport.org> "In Support of Richard Stallman"
- I am Brazilian. I hope my English is correct and I welcome feedback.
- Free Software Supporter: <https://www.fsf.org/free-software-supporter>
- If an email of mine arrives at your spam box, please notify me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: Reclocking errors out if org-log-note-clock-out is t [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)]
2021-05-30 0:53 Bug: Reclocking errors out if org-log-note-clock-out is t [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)] Jorge P. de Morais Neto
@ 2021-05-30 1:39 ` Jorge P. de Morais Neto
2021-05-31 13:43 ` Ihor Radchenko
1 sibling, 0 replies; 5+ messages in thread
From: Jorge P. de Morais Neto @ 2021-05-30 1:39 UTC (permalink / raw)
To: emacs-orgmode
Hi. I continue below:
Em [2021-05-29 sáb 21:53:47-0300], Jorge P. de Morais Neto escreveu:
> I stepped through the code and verified the error is triggered at line
> 1726 on file org-clock.el. This is the form
> (org-back-to-heading t)
> on function `org-clock-remove-empty-clock-drawer'. That function runs
> as a hook because of line 1717 on file `org-clock.el':
> (run-hooks 'org-clock-out-hook)
> on function `org-clock-out'.
For the record: I don't remember why I couldn't get a clear backtrace
and resorted to stepping through the code until I found the error; but I
am indeed aware the stepping is unnecessary in a case like this.
Regards
--
- <https://stallmansupport.org> "In Support of Richard Stallman"
- If an email of mine arrives at your spam box, please notify me.
- Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
- Free/libre software for Replicant, LineageOS and Android: https://f-droid.org
- [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: Reclocking errors out if org-log-note-clock-out is t [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)]
2021-05-30 0:53 Bug: Reclocking errors out if org-log-note-clock-out is t [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)] Jorge P. de Morais Neto
2021-05-30 1:39 ` Jorge P. de Morais Neto
@ 2021-05-31 13:43 ` Ihor Radchenko
2021-06-07 15:15 ` Jorge P. de Morais Neto
2021-09-26 6:04 ` Bastien
1 sibling, 2 replies; 5+ messages in thread
From: Ihor Radchenko @ 2021-05-31 13:43 UTC (permalink / raw)
To: Jorge P. de Morais Neto; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 451 bytes --]
"Jorge P. de Morais Neto" <jorge+list@disroot.org> writes:
> - Expected behavior: Org should clock in the first heading, then clock
> out from it, prompt for a note, and clock in the second heading (in
> batch mode, Emacs should print some clocking messages and then exit
> successfully).
> - What happens: Org errors out:
> user-error: Before first headline at position 164 in buffer *Org Note*
Confirmed
The fix is attached.
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Correctly-handle-org-log-note-clock-out-non-interact.patch --]
[-- Type: text/x-diff, Size: 1156 bytes --]
From 7dc855ae1d7992eaacc2cab13a39c6000e4e66bf Mon Sep 17 00:00:00 2001
Message-Id: <7dc855ae1d7992eaacc2cab13a39c6000e4e66bf.1622468529.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Mon, 31 May 2021 21:39:51 +0800
Subject: [PATCH] Correctly handle org-log-note-clock-out non-interactively
* lisp/org-clock.el (org-clock-out): Delay log popup to
after-command-hook to avoid messing up non-interactive calls.
`org-add-log-setup' without 'note argument would raise interactive
note buffer immediately, so we do pass the 'note argument.
---
lisp/org-clock.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 3b7d97639..0328bddd3 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1691,7 +1691,7 @@ (defun org-clock-out (&optional switch-to-state fail-quietly at-time)
(line-beginning-position 2)))
(org-log-note-clock-out
(org-add-log-setup
- 'clock-out nil nil nil
+ 'clock-out nil nil 'note
(concat "# Task: " (org-get-heading t) "\n\n"))))
(when org-clock-mode-line-timer
(cancel-timer org-clock-mode-line-timer)
--
2.26.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Bug: Reclocking errors out if org-log-note-clock-out is t [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)]
2021-05-31 13:43 ` Ihor Radchenko
@ 2021-06-07 15:15 ` Jorge P. de Morais Neto
2021-09-26 6:04 ` Bastien
1 sibling, 0 replies; 5+ messages in thread
From: Jorge P. de Morais Neto @ 2021-06-07 15:15 UTC (permalink / raw)
To: emacs-orgmode
Em [2021-05-31 seg 21:43:23+0800], Ihor Radchenko escreveu:
> Confirmed
>
> The fix is attached.
I have applied (by copying the Guix package recipe and then modifying
it) Ihor's patch and customized `org-log-note-clock-out' back to t.
Since then I have been using the patched Org it and I can confirm Ihor's
patch fixes the problem.
Thank you Ihor!
--
- <https://stallmansupport.org> "In Support of Richard Stallman"
- I am Brazilian. I hope my English is correct and I welcome feedback.
- <https://www.defectivebydesign.org>
- <https://www.gnu.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: Reclocking errors out if org-log-note-clock-out is t [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)]
2021-05-31 13:43 ` Ihor Radchenko
2021-06-07 15:15 ` Jorge P. de Morais Neto
@ 2021-09-26 6:04 ` Bastien
1 sibling, 0 replies; 5+ messages in thread
From: Bastien @ 2021-09-26 6:04 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Jorge P. de Morais Neto, emacs-orgmode
Hi Ihor,
Ihor Radchenko <yantar92@gmail.com> writes:
> The fix is attached.
Applied in the bugfix branch, thanks. The fix is only for the bugfix
branch, since this part in the main branch has been rewritten. Don't
hesitate to double-check this, in case something is wrong.
Thanks!
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-26 6:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-30 0:53 Bug: Reclocking errors out if org-log-note-clock-out is t [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)] Jorge P. de Morais Neto
2021-05-30 1:39 ` Jorge P. de Morais Neto
2021-05-31 13:43 ` Ihor Radchenko
2021-06-07 15:15 ` Jorge P. de Morais Neto
2021-09-26 6:04 ` Bastien
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.