From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gaizka Villate Subject: Is it possible to automatically set the timestamp recorded in a CLOSED: annotation to a different time than now? Date: Wed, 12 Sep 2012 11:38:27 +0200 Message-ID: <20120912093827.GA25971@hobitton> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:51540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBjP4-0004qR-HC for emacs-orgmode@gnu.org; Wed, 12 Sep 2012 05:38:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBjP3-0004zz-GG for emacs-orgmode@gnu.org; Wed, 12 Sep 2012 05:38:38 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:50610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBjP3-0004xo-A2 for emacs-orgmode@gnu.org; Wed, 12 Sep 2012 05:38:37 -0400 Received: by weys10 with SMTP id s10so957664wey.0 for ; Wed, 12 Sep 2012 02:38:36 -0700 (PDT) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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