unofficial mirror of emacs-orgmode@gnu.org
 help / color / mirror / Atom feed
* A small bufix in org-clock-in
@ 2021-02-16 16:38 Jean-Marie Gaillourdet
  2021-02-16 19:53 ` A small bugfix " Jean-Marie Gaillourdet
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Marie Gaillourdet @ 2021-02-16 16:38 UTC (permalink / raw)
  To: emacs-orgmode

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


--=-=-=--

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A small bugfix in org-clock-in
  2021-02-16 16:38 A small bufix in org-clock-in Jean-Marie Gaillourdet
@ 2021-02-16 19:53 ` Jean-Marie Gaillourdet
  2021-02-17  4:45   ` Kyle Meyer
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Marie Gaillourdet @ 2021-02-16 19:53 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

I am sorry, for the mess in my previous mail.

I've experienced occasionally errors while executing org-clock-in 
from
the agenda. The errors seems to be that indent-line-to is called 
with a
negative argument. 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 to org-mode.

Kind regards,
Jean-Marie


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-clock-fix-runtime-error-in-org-clock-in.patch --]
[-- Type: text/x-patch, Size: 1040 bytes --]

From 319785492d55d33cdf819aa891c3e7834dafacff Mon Sep 17 00:00:00 2001
From: Jean-Marie Gaillourdet <jm@gaillourdet.net>
Date: Sun, 13 Dec 2020 12:50:52 +0100
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


[-- Attachment #3: Type: text/plain, Size: 30 bytes --]





--
Jean-Marie Gaillourdet

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A small bugfix in org-clock-in
  2021-02-16 19:53 ` A small bugfix " Jean-Marie Gaillourdet
@ 2021-02-17  4:45   ` Kyle Meyer
  0 siblings, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2021-02-17  4:45 UTC (permalink / raw)
  To: Jean-Marie Gaillourdet; +Cc: emacs-orgmode

Jean-Marie Gaillourdet writes:
> I've experienced occasionally errors while executing org-clock-in from
> the agenda. The errors seems to be that indent-line-to is called with
> a negative argument. 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 to org-mode.

I agree the change is safe, though I couldn't figure out how to get into
a state where it'd be needed.  Anyway, pushed (ee4ffa567), adding
TINYCHANGE to the commit message.

Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-17  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 16:38 A small bufix in org-clock-in Jean-Marie Gaillourdet
2021-02-16 19:53 ` A small bugfix " Jean-Marie Gaillourdet
2021-02-17  4:45   ` Kyle Meyer

unofficial mirror of emacs-orgmode@gnu.org

This inbox may be cloned and mirrored by anyone:

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

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 http://ou63pmih66umazou.onion/public-inbox.git