From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viktor Rosenfeld Subject: Re: [PATCH] Fix clocking on capture completion Date: Sun, 25 Jul 2010 00:09:26 +0200 Message-ID: <20100724220926.GA251@stan> References: <1279981217-14625-1-git-send-email-bernt@norang.ca> <20100724184151.GA97728@stan> <878w50vhuh.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=46311 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcmuS-0005ke-TQ for emacs-orgmode@gnu.org; Sat, 24 Jul 2010 18:09:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OcmuR-0005CN-7S for emacs-orgmode@gnu.org; Sat, 24 Jul 2010 18:09:32 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:33251) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OcmuQ-0005CI-WB for emacs-orgmode@gnu.org; Sat, 24 Jul 2010 18:09:31 -0400 Received: by fxm20 with SMTP id 20so6205223fxm.0 for ; Sat, 24 Jul 2010 15:09:30 -0700 (PDT) Content-Disposition: inline In-Reply-To: <878w50vhuh.fsf@gollum.intra.norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernt Hansen Cc: emacs-orgmode@gnu.org Hi Bernt, thanks for the updated version. It works as expected. Cheers, Viktor Bernt Hansen wrote: > Viktor Rosenfeld writes: > > > A somewhat related question: I use your bh/clock-in-to-next function to > > change the todo state to STARTED when clocking in TODO tasks. > > Unfortunately it is being applied to Capture buffers. I tried changing > > the buffer-name to "CAPTURE-*" but that didn't help. > > I've updated the function for capture mode but not posted the changes to > my doc.norang.ca yet. Here's the function that works for me with > capture and remember mode. I'm going to be removing the remember mode > logic since I no longer use that. > > (defun bh/clock-in-to-next (kw) > "Switch task from TODO to NEXT when clocking in. > Skips remember tasks and tasks with subtasks" > (if (and (string-equal kw "TODO") > (not (string-equal (buffer-name) "*Remember*")) > (not (and (boundp 'org-capture-mode) org-capture-mode))) > (let ((subtree-end (save-excursion (org-end-of-subtree t))) > (has-subtask nil)) > (save-excursion > (forward-line 1) > (while (and (not has-subtask) > (< (point) subtree-end) > (re-search-forward "^\*+ " subtree-end t)) > (when (member (org-get-todo-state) org-not-done-keywords) > (setq has-subtask t)))) > (when (not has-subtask) > "NEXT"))))