Is there a way to use ido to select tasks from the org-clock-select-task
list? Having to read through the list to find the right task and then look at the number makes me lose my flow :)
I use the following snippet to select a recently clocked task with ido
:
(defun org-clock-in-select ()
(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 (cdr (assoc (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)))))))
I eventually expanded this into a package org-mru-clock. This also pre-fills the clock history), and allows using ivy or ido, by setting org-mru-clock-completing-read
to whichever completing-read-function you prefer (defaulting to the value of completing-read-function
), for example: (setq org-mru-clock-completing-read #'ivy-completing-read)
.
org-clock-select-task
does not use acompleting-read
of any sort, there is not a way to connect it toido
without rolling your own version of the function. – nispio Mar 30 '16 at 18:37