emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Log change TODO state after clock-out


From: Рома Рудаков
Subject: [O] Log change TODO state after clock-out
Date: Wed, 26 Jul 2017 15:42:23 +0300

Hello,
my minimal configuration:

(setq org-todo-keywords
      '((sequence "TODO(t)" "PROGRESS(p!)" "WAITING(w!)" "|" "DONE(d!)")))

(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)
(setq org-log-into-drawer t)
(setq org-log-done 'time)

(defun rr/set-progress (last)
  "Set PROGRESS state if LAST is different."
  (when (not (string-equal last "PROGRESS"))
      "PROGRESS"))

(setq org-clock-in-switch-to-state 'rr/set-progress)

(defun rr/after-clock-stop (last)
  "Change TASK state after clock stop depends on LAST state."
  (when (not (or (string-equal last "WAITING")
                 (string-equal last "DONE")
                 (string-equal last "TODO")))
      (if (y-or-n-p "Current task DONE? ")
            "DONE"
          "WAITING")))

(setq org-clock-out-switch-to-state 'rr/after-clock-stop)

I have a simple org file:

* TODO task 1
* TODO task 2
* TODO task 3
* TODO task 4

Steps to reproduce my issue:
1. Go to task 1 and clock-in. Result is:

* PROGRESS task 1
  :LOGBOOK:
  - State "PROGRESS"   from "TODO"       [2017-07-26 Wed 15:37]
  CLOCK: [2017-07-26 Wed 15:37]
  :END:
* TODO task 2
* TODO task 3
* TODO task 4

2. Clock-out the task, answer y or n.

Expected result:

* DONE task 1
  CLOSED: [2017-07-26 Wed 15:39]
  :LOGBOOK:
  - State "DONE"       from "PROGRESS"   [2017-07-26 Wed 15:39]
  - State "PROGRESS"   from "TODO"       [2017-07-26 Wed 15:37]
  CLOCK: [2017-07-26 Wed 15:37]--[2017-07-26 Wed 15:38] =>  0:01
  :END:
* TODO task 2
* TODO task 3
* TODO task 4


Actual result:

* DONE task 1
  :LOGBOOK:
  - State "PROGRESS"   from "TODO"       [2017-07-26 Wed 15:37]
  CLOCK: [2017-07-26 Wed 15:37]--[2017-07-26 Wed 15:38] =>  0:01
  :END:
* TODO task 2
* TODO task 3
* TODO task 4

There is no CLOSED log entry and change state from PROGRESS to DONE entry.

Please help me to find proper configuration.
Thank you in advance.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]