emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jean-Marie Gaillourdet <jmg@gaillourdet.net>
To: emacs-orgmode@gnu.org
Subject: A small bufix in org-clock-in
Date: Tue, 16 Feb 2021 17:38:06 +0100	[thread overview]
Message-ID: <87y2fokm6b.fsf@gaillourdet.net> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="=-=-=", Size: 1756 bytes --]

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

Hello,

I've experienced occasionally errors while executing org-clock-in from
the agenda. Moving from the agenda to the todo headline in the
underlying org file and repeating org-clock-in and org-clock-out usually
lead to a state in which I could successfully run org-clock-in.

The following patch fixes the issue for me and I believe it does no
harm. I've used it daily for two month. I'd appreciate if you could add
it org-mode.

Kind regards,
  Jean-Marie

-- Jean-Marie Gaillourdet

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-org-clock-fix-runtime-error-in-org-clock-in.patch

From 319785492d55d33cdf819aa891c3e7834dafacff Mon Sep 17 00:00:00 2001
From: Jean-Marie Gaillourdet <jm@gaillourdet.net>
Subject: [PATCH] org-clock: fix runtime error in org-clock-in

* org-clock.el (org-clock-in): Under certain configurations of org,
Emacs doom, evil-org-mode and my custom settings, org-clock-in aborts
with an an error because indent-line-to is called with -2.
---
 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 6c7a797ff..4256b1a21 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1368,7 +1368,7 @@ the default behavior."
 			(end-of-line 0)
 			(org-in-item-p)))
 	     (beginning-of-line 1)
-	     (indent-line-to (- (current-indentation) 2)))
+	     (indent-line-to (max 0 (- (current-indentation) 2))))
 	   (insert org-clock-string " ")
 	   (setq org-clock-effort (org-entry-get (point) org-effort-property))
 	   (setq org-clock-total-time (org-clock-sum-current-item
--
2.29.2


--=-=-=--

             reply	other threads:[~2021-02-16 17:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 16:38 Jean-Marie Gaillourdet [this message]
2021-02-16 19:53 ` A small bugfix in org-clock-in Jean-Marie Gaillourdet
2021-02-17  4:45   ` Kyle Meyer

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87y2fokm6b.fsf@gaillourdet.net \
    --to=jmg@gaillourdet.net \
    --cc=emacs-orgmode@gnu.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).