This will be short (and sweet).
org-clock-in offers a list of recently clocked tasks to select from when called with one C-u (known as the
universal-argument). Unfortunately, the task selection doesn’t use any completion engine. Therefore I prefer the following snippet, using
ido for completion:
(defun bp/org-clock-in-select () "Select a task to clock into from a list of recently clocked items." (interactive) (let (res) (dolist (i org-clock-history) (with-current-buffer (org-base-buffer (marker-buffer i)) (org-with-wide-buffer (ignore-errors (goto-char (marker-position i)) (push `(,(org-get-heading 'notags) . ,i) res))))) (let* ((l (reverse (mapcar 'car res))) (task (alist-get (ido-completing-read "Recent Clocks: " l) res))) (when task (with-current-buffer (org-base-buffer (marker-buffer task)) (org-with-wide-buffer (goto-char (marker-position task)) (org-clock-in)))))))