Org-mode mailing list
 help / color / mirror / Atom feed
From: Ihor Radchenko <>
To: "Jorge P. de Morais Neto" <>
Subject: 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/)]
Date: Mon, 31 May 2021 21:43:23 +0800
Message-ID: <877djf10jo.fsf@localhost> (raw)
In-Reply-To: <>

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

"Jorge P. de Morais Neto" <> 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*


The fix is attached.


[-- 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: <>
From: Ihor Radchenko <>
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)))
-		  '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)

  parent reply	other threads:[~2021-05-31 13:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-06-07 15:15   ` Jorge P. de Morais Neto

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:

  List information:

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

  git send-email \
    --in-reply-to=877djf10jo.fsf@localhost \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ \
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:

AGPL code for this site: git clone