From 52797d3917c594a5ffe96efe954630212e414748 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 15 Aug 2019 16:36:27 -0700 Subject: [PATCH] Switch to IN-PROGRESS when clocking in When a task is TODO and I clock in, automatically switch it to IN-PROGRESS. Leave it as is if it's any other state. --- oni-org.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/oni-org.el b/oni-org.el index 09310d6..59170d1 100644 --- a/oni-org.el +++ b/oni-org.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190721235442 +;; Version: 20190815163343 ;; Package-Requires: (org-plus-contrib org-bullets hydra org-wild-notifier) ;; This program is free software; you can redistribute it and/or modify @@ -29,6 +29,7 @@ (require 'hydra) (require 'org) (require 'org-capture) +(require 'org-clock) (require 'org-habit) (defun oni-org-expand-to-home (file-name) @@ -98,6 +99,12 @@ After running it once remove it from `org-capture-after-finalize-hook'." (setf (frame-height) 24) (add-hook 'org-capture-after-finalize-hook 'oni-org-delete-frame-once))) +(defun oni-org-maybe-change-todo-state (current-state) + "Change the state of the current task to in-progress CURRENT-STATE is todo." + (if (string= current-state "TODO") + "IN-PROGRESS" + current-state)) + ;;;###autoload (defun oni-org-open-index () "Open the index of my org-based personal wiki." @@ -123,6 +130,7 @@ After running it once remove it from `org-capture-after-finalize-hook'." (setq org-log-into-drawer t) (setq org-agenda-todo-ignore-scheduled 'future) (setq org-agenda-skip-function-global #'oni-org-skip-tasks) +(setq org-clock-in-switch-to-state #'oni-org-maybe-change-todo-state) (setq org-agenda-custom-commands '(("c" "Today's (Current) tasks" tags "SCHEDULED=\"\"")))