Org-mode mailing list
 help / color / mirror / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: "Jorge P. de Morais Neto" <jorge+list@disroot.org>
Cc: emacs-orgmode@gnu.org
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: <87h7ilm484.fsf@disroot.org>

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


  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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

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

  git send-email \
    --in-reply-to=877djf10jo.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jorge+list@disroot.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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 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/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git