From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Guerry Subject: [Accepted] Fix marker in no buffer error for task state change in an indirect buffer Date: Sun, 11 Dec 2011 18:23:13 +0100 (CET) Message-ID: <20111211172313.F136F13E90@myhost.localdomain> References: <1321739047-11936-1-git-send-email-bernt@norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:47649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZn6P-0001Co-0E for emacs-orgmode@gnu.org; Sun, 11 Dec 2011 12:22:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RZn6N-0007gL-Hp for emacs-orgmode@gnu.org; Sun, 11 Dec 2011 12:22:16 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:48704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZn6N-0007gH-AC for emacs-orgmode@gnu.org; Sun, 11 Dec 2011 12:22:15 -0500 Received: by eekc41 with SMTP id c41so2689284eek.0 for ; Sun, 11 Dec 2011 09:22:14 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Patch 1050 (http://patchwork.newartisans.com/patch/1050/) is now "Accepted". Maintainer comment: none This relates to the following submission: http://mid.gmane.org/%3C1321739047-11936-1-git-send-email-bernt%40norang.ca%3E Here is the original message containing the patch: > Content-Type: text/plain; charset="utf-8" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Subject: [O] Fix marker in no buffer error for task state change in an > indirect buffer > Date: Sun, 20 Nov 2011 02:44:07 -0000 > From: Bernt Hansen > X-Patchwork-Id: 1050 > Message-Id: <1321739047-11936-1-git-send-email-bernt@norang.ca> > To: emacs-orgmode@gnu.org > Cc: Bernt Hansen , carsten.dominik@gmail.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) >