Function: org-clock-in-last

org-clock-in-last is an autoloaded, interactive and byte-compiled function defined in org-clock.el.gz.

Signature

(org-clock-in-last &optional ARG)

Documentation

Clock in the last closed clocked item.

When already clocking in, send a warning. With a universal prefix argument, select the task you want to clock in from the last clocked in tasks. With two universal prefix arguments, start clocking using the last clock-out time, if any. With three universal prefix arguments, interactively prompt for a todo state to switch to, overriding the existing value org-clock-in-switch-to-state.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-clock.el.gz
;;;###autoload
(defun org-clock-in-last (&optional arg)
  "Clock in the last closed clocked item.
When already clocking in, send a warning.
With a universal prefix argument, select the task you want to
clock in from the last clocked in tasks.
With two universal prefix arguments, start clocking using the
last clock-out time, if any.
With three universal prefix arguments, interactively prompt
for a todo state to switch to, overriding the existing value
`org-clock-in-switch-to-state'."
  (interactive "P")
  (if (equal arg '(4)) (org-clock-in arg)
    (let ((start-time (if (or org-clock-continuously (equal arg '(16)))
			  (or org-clock-out-time
			      (org-current-time org-clock-rounding-minutes t))
			(org-current-time org-clock-rounding-minutes t))))
      (if (null org-clock-history)
	  (message "No last clock")
	(let ((org-clock-in-switch-to-state
	       (if (and (not org-clock-current-task) (equal arg '(64)))
		   (completing-read "Switch to state: "
				    (and org-clock-history
					 (with-current-buffer
					     (marker-buffer (car org-clock-history))
					   org-todo-keywords-1)))
		 org-clock-in-switch-to-state))
	      (already-clocking org-clock-current-task))
	  (org-clock-clock-in (list (car org-clock-history)) nil start-time)
	  (or already-clocking
	      ;; Don't display a message if we are already clocking in
	      (message "Clocking back: %s (in %s)"
		       org-clock-current-task
		       (buffer-name (marker-buffer org-clock-marker)))))))))