emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: emacs-orgmode@gnu.org
Cc: Bernt Hansen <bernt@norang.ca>, carsten.dominik@gmail.com
Subject: [PATCH] Fix marker in no buffer error for task state change in an indirect buffer
Date: Sat, 19 Nov 2011 16:44:07 -0500	[thread overview]
Message-ID: <1321739047-11936-1-git-send-email-bernt@norang.ca> (raw)
In-Reply-To: <m2obw99uc4.fsf@pluto.luannocracy.com>

* lisp/org-clock.el (org-clock-out-if-current): Fix marker in no buffer error
  for task state change in an indirect buffer

org-clock-out-when-current was enhanced in 098cf35 (Clock: Clock out
when done also in indirect buffers, 2009-03-23) to handle indirect
buffers.

This enhancement uses (buffer-base-buffer (org-clocking-buffer)) but
when not clocking (org-clocking-buffer) returns nil - so
buffer-base-buffer returns the base buffer of the current buffer which
is never nil.  This leads to marker in no buffer errors trying to stop
the clock when it is not running.

Now we explicitly check up front that the clock is running before
any other conditions that lead to stopping the clock.
---

cc:ing Carsten since this is his code

Hi Dave,

After much difficulty I was able to reproduce this problem.  It would
have been helpful to include basic information about what triggers the
bug for you.

  - clock is not running
  - You are working in an indirect buffer
  - You change a todo state keyword to DONE

This works fine for me when not in an indirect buffer.

The git commit you have referenced in this report is not part of the org
repository which also made me think you had local changes that affected
this issue since I couldn't reproduce it for the first 20 minutes of
looking at this issue.

Please try this patch and report back if it works or not.

Thanks,
Bernt


 lisp/org-clock.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 5dbe4dc..9107400 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1696,7 +1696,8 @@ from the `before-change-functions' in the current buffer."
   "Clock out if the current entry contains the running clock.
 This is used to stop the clock after a TODO entry is marked DONE,
 and is only done if the variable `org-clock-out-when-done' is not nil."
-  (when (and org-clock-out-when-done
+  (when (and (org-clocking-p)
+	     org-clock-out-when-done
 	     (or (and (eq t org-clock-out-when-done)
 		      (member state org-done-keywords))
 		 (and (listp org-clock-out-when-done)
-- 
1.7.8.rc3

  reply	other threads:[~2011-11-19 21:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18 18:08 Bug: org-clock-out-if-current => "marker does not point anywhere" [7.7 (release_7.7.397.g5adafd)] Dave Abrahams
2011-11-19 21:44 ` Bernt Hansen [this message]
2011-12-11 17:23   ` [Accepted] Fix marker in no buffer error for task state change in an indirect buffer Bastien Guerry
2011-12-11 17:23   ` [PATCH] " Bastien
2011-11-23  4:49 ` [PATCH] Bug: org-clock-out-if-current => "marker does not point anywhere" [7.7 (release_7.7.397.g5adafd)] Dave Abrahams

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=1321739047-11936-1-git-send-email-bernt@norang.ca \
    --to=bernt@norang.ca \
    --cc=carsten.dominik@gmail.com \
    --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).