From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp1 ([2001:41d0:2:bcc0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms0.migadu.com with LMTPS
	id UFoIDCUKs2CUdQAAgWs5BA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 30 May 2021 05:44:37 +0200
Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp1 with LMTPS
	id CFooByUKs2A6ZgAAbx9fmQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 30 May 2021 03:44:37 +0000
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 697E421A54
	for <larch@yhetil.org>; Sun, 30 May 2021 05:44:36 +0200 (CEST)
Received: from localhost ([::1]:50708 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1lnCNP-00014x-DJ
	for larch@yhetil.org; Sat, 29 May 2021 23:44:35 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39550)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jorge+list@disroot.org>)
 id 1lnCMe-00014n-M4
 for emacs-orgmode@gnu.org; Sat, 29 May 2021 23:43:48 -0400
Received: from knopi.disroot.org ([178.21.23.139]:53406)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jorge+list@disroot.org>)
 id 1lnCMc-0003Ke-RA
 for emacs-orgmode@gnu.org; Sat, 29 May 2021 23:43:48 -0400
Received: by disroot.org (Postfix, from userid 107)
 id A17BA529A0; Sun, 30 May 2021 05:54:56 +0200 (CEST)
From: "Jorge P. de Morais Neto" <jorge+list@disroot.org>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail;
 t=1622336036; bh=r0arlO6rlV54v6ZWaCMlRAreRGOufr8HzXs8DycsN10=;
 h=From:To:Subject:Date;
 b=bXJtWl1smY2KylqzzEC6cQdJdQQ0f4Z1rPfw51AGmibGCv72K37GwETwbrJrODBhH
 ToZ4lZzRjMqFO6yTVU9icgnQSvegqWOCGvjvs0jjv80fJsHPwBsARp9o8Gqi6DoQMG
 SDWKfsYxnvRweddf4A7yLiCbjO55XFOa36T3ZB4S3gH4jj2l3liuAzxUbU3ebaPVPQ
 DyvzkaSVPJOM1HWhn1+YD2GRNAoIkoh/82hsanq9UyTsS9AII2SMeSOKGtdjxHT3kB
 w0uZcc3MPrxb9OXM9FxybJ4gl98WtX6a7lbo5TLUvmVgSFBhU0WCdDr7ihxQ5GL5VW
 y1fQiPbAjAK9A==
To: emacs-orgmode@gnu.org
Subject: 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/)]
Mail-Followup-To: emacs-orgmode@gnu.org
Date: Sat, 29 May 2021 21:53:47 -0300
Message-ID: <87h7ilm484.fsf@disroot.org>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=178.21.23.139;
 envelope-from=jorge+list@disroot.org; helo=knopi.disroot.org
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-orgmode@gnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: "Emacs-orgmode" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1622346276;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=nrwFaBWppr4KjQOXuNcNFi3YWqOkF+6ZaJx4JCrOGhQ=;
	b=cCTrnHpH2JU7+TRd80Qyy3zTFQ7fejUsZWNP7/uvT/F/NxKvGXkZRVygQ9KJegQP9MrOKi
	jEXhm1RM+2Dg6dXulorprjVkhsgXiE/tQGwMGeOPbmM4EIarzu/JrWJ2/uWej9mKv9Z/tf
	BfLImSDDsjNAE4YfvEMWai2YdzenjrTHEcrMuOgbRCJCyp0eJI6Yh9L7CUtK6K6wD9cyLi
	XbOuO7//X+HM4GPHtwOqf7i4uu63HPPUxW5otwSXpkqcPdO2zuGWK7Uzi1ZdWyomeZ+2bF
	qfx3GpMQ98ecO0QVAymdoIiTMc0kKmrlYXxtRW5eUgA5nQQg+ADlIV/8LIIshQ==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622346276; a=rsa-sha256; cv=none;
	b=b+4RvFzJr1FKnYEueH2emp1uXRQ9ahtywKY1K/R1zCmDOzMZrwEWWQ0QwHY1x64GO+C9rR
	n33IigsoQS0WHfprTDcfpH+emov10MuEVmWWhM8lAwwl1t98RyG17UCHqxJRGUW0WoKDAG
	ME38jcna6yoelXWY8gXkWFvDlEvMbxoeO9Y59BQztlfTA/D/gpWvzo3IPmCVJSr050sKvH
	X52inCsRxTJIn9a42zBRwN1POWtQJ6hqzEbHdOClpm4p2ibEz6I2vK+294peGJr3LCATbE
	fsParHCwevjcEBJx/HpkMt/tGOcsjq8a8AbSCEgPfHQlcfnaH1g4Udgjc8w9WA==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=disroot.org header.s=mail header.b=bXJtWl1s;
	dmarc=pass (policy=quarantine) header.from=disroot.org;
	spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org
X-Migadu-Spam-Score: -2.53
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=disroot.org header.s=mail header.b=bXJtWl1s;
	dmarc=pass (policy=quarantine) header.from=disroot.org;
	spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org
X-Migadu-Queue-Id: 697E421A54
X-Spam-Score: -2.53
X-Migadu-Scanner: scn1.migadu.com
X-TUID: 2xlZXHwFYvP6

--=-=-=
Content-Type: application/emacs-lisp
Content-Disposition: attachment; filename=org-log-note-clock-out--bug.el
Content-Transfer-Encoding: quoted-printable
Content-Description: Elisp to reproduce the bug

;;; org-log-note-clock-out--bug.el ---               -*- lexical-binding: t=
; -*-

(setq org-log-note-clock-out t)
(switch-to-buffer (generate-new-buffer "org-log-note-clock-out--bug.org"))
(org-mode)
(insert "* H1\n* H2\n")
(goto-char (point-min))
(org-clock-in)
(org-next-visible-heading 1)
(org-clock-in)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi.  I use Emacs from Guix---package emacs-next installed from Git
master (through --with-branch=3Demacs-next=3Dmaster) and updated weekly.
Org is also from Guix: packages emacs-org{,-contrib,-drill,-pdftools}

To reproduce the bug, save the attached file=C2=B9 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

=C2=B9 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/2pny4z6mbi2aybg=
zzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)
--=20
- <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.

--=-=-=--