Hi Bernt, thanks for the updated version. It works as expected.
Cheers, Viktor Bernt Hansen wrote: > Viktor Rosenfeld <listuse...@googlemail.com> 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")))) _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode