emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Is it possible to automatically set the timestamp recorded in a CLOSED: annotation to a different time than now?
@ 2012-09-12  9:38 Gaizka Villate
  2012-09-19  9:37 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Gaizka Villate @ 2012-09-12  9:38 UTC (permalink / raw)
  To: emacs-orgmode

Hi there!

I'd like to accomplish this. If anybody can tell me at least if that's a feasible thing to do with org-mode, i'll try to develop it myself :)

I log time spent in my tasks (with org-clock), which I usually leave in STARTED state (because maybe there was a bug in my code, and I'd need to spend more time with them.

At the end of the week, or maybe the next week I go through all STARTED tasks and start closing them.

What happens (and that's a normal behaviour) is that the task gets a CLOSED timestamp with right now's date and time.

I then adjust it manually to set it to the last clocked-out timestamp (which, for me, is the last time I spent working on it).

Would it possible to customize org-mode to do this? Does it even make sense?

I guess I'd have to change this lines of org-todo:

	      (when (and now-done-p org-log-done)
		;; It is now done, and it was not done before
		(org-add-planning-info 'closed (org-current-effective-time))
		(if (and (not dolog) (eq 'note org-log-done))
		    (org-add-log-setup 'done org-state this 'findpos 'note)))
	      (when (and org-state dolog)
		;; This is a non-nil state, and we need to log it
		(org-add-log-setup 'state org-state this 'findpos dolog)))

To call org-current-effective-time with an extra param that takes last timestamped clock's end time and returns it instead of org-current-time.

(defun org-current-effective-time ()
  "Return current time adjusted for `org-extend-today-until' variable"
  (let* ((ct (org-current-time))
	  (dct (decode-time ct))
	  (ct1
	   (if (and org-use-effective-time
		    (< (nth 2 dct) org-extend-today-until))
	       (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct))
	     ct)))
    ct1))


How could I get last timestamped clock's end time?

Thanks a lot for your help, and thanks even more for org-mode!!

-- Gaizka

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

* Re: Is it possible to automatically set the timestamp recorded in a CLOSED: annotation to a different time than now?
  2012-09-12  9:38 Is it possible to automatically set the timestamp recorded in a CLOSED: annotation to a different time than now? Gaizka Villate
@ 2012-09-19  9:37 ` Bastien
  2012-09-19 10:23   ` Gaizka Villate
  2012-09-21 12:15   ` Nicolas Girard
  0 siblings, 2 replies; 4+ messages in thread
From: Bastien @ 2012-09-19  9:37 UTC (permalink / raw)
  To: Gaizka Villate; +Cc: emacs-orgmode

Hi Gaizka,

Gaizka Villate <gaizkav@gmail.com> writes:

> I then adjust it manually to set it to the last clocked-out timestamp
> (which, for me, is the last time I spent working on it).

I introduced `org-use-last-clock-out-time-as-effective-time' which lets
you do this automatically.  You can test it from the git master branch
for now, it will be in the next major release.

Thanks for this idea!

-- 
 Bastien

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

* Re: Is it possible to automatically set the timestamp recorded in a CLOSED: annotation to a different time than now?
  2012-09-19  9:37 ` Bastien
@ 2012-09-19 10:23   ` Gaizka Villate
  2012-09-21 12:15   ` Nicolas Girard
  1 sibling, 0 replies; 4+ messages in thread
From: Gaizka Villate @ 2012-09-19 10:23 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Wow!

It works great! Thanks a lot!!

-- Gaizka

El día 19/09/12 11:37 +0200, Bastien escribió: 
> Hi Gaizka,
> 
> Gaizka Villate <gaizkav@gmail.com> writes:
> 
> > I then adjust it manually to set it to the last clocked-out timestamp
> > (which, for me, is the last time I spent working on it).
> 
> I introduced `org-use-last-clock-out-time-as-effective-time' which lets
> you do this automatically.  You can test it from the git master branch
> for now, it will be in the next major release.
> 
> Thanks for this idea!
> 

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

* Re: Is it possible to automatically set the timestamp recorded in a CLOSED: annotation to a different time than now?
  2012-09-19  9:37 ` Bastien
  2012-09-19 10:23   ` Gaizka Villate
@ 2012-09-21 12:15   ` Nicolas Girard
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Girard @ 2012-09-21 12:15 UTC (permalink / raw)
  To: emacs-orgmode

2012/9/19 Bastien <bzg@altern.org>:
>
> I introduced `org-use-last-clock-out-time-as-effective-time' which lets
> you do this automatically.  You can test it from the git master branch
> for now, it will be in the next major release.
>

Useful idea, indeed, thanks for implementing it !

-- 
Nicolas

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

end of thread, other threads:[~2012-09-21 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-12  9:38 Is it possible to automatically set the timestamp recorded in a CLOSED: annotation to a different time than now? Gaizka Villate
2012-09-19  9:37 ` Bastien
2012-09-19 10:23   ` Gaizka Villate
2012-09-21 12:15   ` Nicolas Girard

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