emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Log change TODO state after clock-out
@ 2017-07-26 12:42 Рома Рудаков
  2017-07-28 13:44 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Рома Рудаков @ 2017-07-26 12:42 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 2647 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Log change TODO state after clock-out
  2017-07-26 12:42 Log change TODO state after clock-out Рома Рудаков
@ 2017-07-28 13:44 ` Nicolas Goaziou
  2017-07-29 13:52   ` Roman Rudakov
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2017-07-28 13:44 UTC (permalink / raw)
  To: Рома Рудаков
  Cc: emacs-orgmode

Hello,

Рома Рудаков <phentagram@gmail.com> writes:

> 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.

Logging was inhibited when using `org-clock-out-switch-to-state', but
not when using `org-clock-in-switch-to-state'. I assume this is a bug,
so I removed it.

I may be wrong though, so this change is in master only.

Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Log change TODO state after clock-out
  2017-07-28 13:44 ` Nicolas Goaziou
@ 2017-07-29 13:52   ` Roman Rudakov
  2017-08-05 12:47     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Roman Rudakov @ 2017-07-29 13:52 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2175 bytes --]

Hello,
I've tried to remove line (org-inhibit-logging t) locally, it have solved
my problem partially.

If I clock-in and then clock-out the same headline everything is ok (Task 1
in my example)
. But if I clock-in Task 2, Then go to Task 3 and ckock it in, Task 2
clocked out and have only CLOSED log entry, but it doesn't have log about
change state from PROGRESS to DONE.

Example:

* DONE Task 1
CLOSED: [2017-07-29 Sat 16:45]
:LOGBOOK:
- State "DONE"       from "PROGRESS"   [2017-07-29 Sat 16:45]
- State "PROGRESS"   from "TODO"       [2017-07-29 Sat 16:45]
CLOCK: [2017-07-29 Sat 16:45]--[2017-07-29 Sat 16:45] =>  0:00
:END:

* DONE Task 2
CLOSED: [2017-07-29 Sat 16:45]
:LOGBOOK:
- State "PROGRESS"   from "TODO"       [2017-07-29 Sat 16:45]
CLOCK: [2017-07-29 Sat 16:45]--[2017-07-29 Sat 16:45] =>  0:00
:END:

* PROGRESS Task 3
:LOGBOOK:
- State "PROGRESS"   from "TODO"       [2017-07-29 Sat 16:45]
CLOCK: [2017-07-29 Sat 16:45]
:END:


2017-07-28 16:44 GMT+03:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Hello,
>
> Рома Рудаков <phentagram@gmail.com> writes:
>
> > 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.
>
> Logging was inhibited when using `org-clock-out-switch-to-state', but
> not when using `org-clock-in-switch-to-state'. I assume this is a bug,
> so I removed it.
>
> I may be wrong though, so this change is in master only.
>
> Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 3120 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Log change TODO state after clock-out
  2017-07-29 13:52   ` Roman Rudakov
@ 2017-08-05 12:47     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2017-08-05 12:47 UTC (permalink / raw)
  To: Roman Rudakov; +Cc: emacs-orgmode

Hello,

Roman Rudakov <phentagram@gmail.com> writes:

> I've tried to remove line (org-inhibit-logging t) locally, it have solved
> my problem partially.
>
> If I clock-in and then clock-out the same headline everything is ok (Task 1
> in my example)
> . But if I clock-in Task 2, Then go to Task 3 and ckock it in, Task 2
> clocked out and have only CLOSED log entry, but it doesn't have log about
> change state from PROGRESS to DONE.
>
> Example:
>
> * DONE Task 1
> CLOSED: [2017-07-29 Sat 16:45]
> :LOGBOOK:
> - State "DONE"       from "PROGRESS"   [2017-07-29 Sat 16:45]
> - State "PROGRESS"   from "TODO"       [2017-07-29 Sat 16:45]
> CLOCK: [2017-07-29 Sat 16:45]--[2017-07-29 Sat 16:45] =>  0:00
> :END:
>
> * DONE Task 2
> CLOSED: [2017-07-29 Sat 16:45]
> :LOGBOOK:
> - State "PROGRESS"   from "TODO"       [2017-07-29 Sat 16:45]
> CLOCK: [2017-07-29 Sat 16:45]--[2017-07-29 Sat 16:45] =>  0:00
> :END:
>
> * PROGRESS Task 3
> :LOGBOOK:
> - State "PROGRESS"   from "TODO"       [2017-07-29 Sat 16:45]
> CLOCK: [2017-07-29 Sat 16:45]
> :END:

I cannot reproduce it. With your minimal configuration in a previous
message and the document above, when clocking in "Task 3", I get
prompted by `rr/after-clock-stop' function and the change state is
properly recorded in  "Task 2".

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-06  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-26 12:42 Log change TODO state after clock-out Рома Рудаков
2017-07-28 13:44 ` Nicolas Goaziou
2017-07-29 13:52   ` Roman Rudakov
2017-08-05 12:47     ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).