Explorar el Código

Add new parameter to the `org-clock-out' command

(org-clock-out): Accept new third parameter `at-time', which permits a
clock to be clocked out at a specific time.  Note that no attempt is
made to verify that the clock out time is later than the clock in time.
John Wiegley hace 15 años
padre
commit
cc039d9016
Se han modificado 2 ficheros con 7 adiciones y 2 borrados
  1. 4 0
      lisp/ChangeLog
  2. 3 2
      lisp/org-clock.el

+ 4 - 0
lisp/ChangeLog

@@ -3,6 +3,10 @@
 	* org-clock.el (org-clock-in): Before creating
 	`org-clock-mode-line-timer', check to make sure an older timer is
 	not currently running.
+	(org-clock-out): Accept new third parameter `at-time', which
+	permits a clock to be clocked out at a specific time.  Note that
+	no attempt is made to verify that the clock out time is later than
+	the clock in time.
 
 	* org.el (org-files-list): New utility function for returning a
 	list of all open org-mode buffers, plus all files used to build

+ 3 - 2
lisp/org-clock.el

@@ -751,7 +751,7 @@ line and position cursor in that line."
 	    (and (re-search-forward org-property-end-re nil t)
 		 (goto-char (match-beginning 0))))))))
 
-(defun org-clock-out (&optional fail-quietly)
+(defun org-clock-out (&optional fail-quietly at-time)
   "Stop the currently running clock.
 If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
   (interactive)
@@ -772,7 +772,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
 	  (goto-char (match-end 0))
 	  (delete-region (point) (point-at-eol))
 	  (insert "--")
-	  (setq te (org-insert-time-stamp (current-time) 'with-hm 'inactive))
+	  (setq te (org-insert-time-stamp (or at-time (current-time))
+					  'with-hm 'inactive))
 	  (setq s (- (org-float-time (apply 'encode-time (org-parse-time-string te)))
 		     (org-float-time (apply 'encode-time (org-parse-time-string ts))))
 		h (floor (/ s 3600))