瀏覽代碼

org-clock.el (org-clock-in-last): New command.

* org-clock.el (org-clock-in-last): New command.

This autoloaded command provides a way to clock in the last clocked
item stored in `org-clock-history' from any buffer.  This is handy
when you don't want to go back to your .org file to clock into the
last clocked task.
Bastien Guerry 13 年之前
父節點
當前提交
9780de8b30
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      lisp/org-clock.el

+ 11 - 0
lisp/org-clock.el

@@ -1235,6 +1235,17 @@ the clocking selection, associated with the letter `d'."
 	    (message "Clock starts at %s - %s" ts msg-extra)
 	    (run-hooks 'org-clock-in-hook)))))))
 
+;;;###autoload
+(defun org-clock-in-last (&optional arg)
+  "Clock in the last closed clocked item.
+When already clocking in, send an warning."
+  (interactive "P")
+  (if arg (org-clock-select-task)
+    (org-clock-clock-in (cons (car org-clock-history) (current-time)))
+    (message "Now clocking in: %s (in %s)"
+	     org-clock-current-task
+	     (buffer-name (marker-buffer org-clock-marker)))))
+
 (defun org-clock-mark-default-task ()
   "Mark current task as default task."
   (interactive)