0

Title is pretty self-explanatory. I apologize for not being able to figure this out myself, I'm new to emacs. When I switch a task from 'todo' to 'in-progress', I would like emacs to automatically clock me in, then when I switch it out of 'in progress' I would like to clock out.

I understand this will need to use variables org-clock-out, org-clock-in, etc., but none of the solutions I have found online seem to work… e.g., this gives me a "and: Symbol’s value as variable is void: state" error.

Thanks for your help; cheers.

1 Answer 1

3

Figured it out. Much simpler than the linked solution.

    (add-hook 'org-after-todo-state-change-hook
              'org-clock-todo-change)
    
    (defun org-clock-todo-change ()
      (if (string= org-state "IN-PROGRESS")
          (org-clock-in)
        (org-clock-out)))
1
  • There might be some funny behavior with this sol. and repeater. See this post for updates.
    – ChasingUG
    Mar 30 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.