3

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 :)

Gracjan Polak
  • 1,082
  • 6
  • 21
unhammer
  • 1,127
  • 8
  • 22
  • 2
    Since `org-clock-select-task` does not use a `completing-read` of any sort, there is not a way to connect it to `ido` without rolling your own version of the function. – nispio Mar 30 '16 at 18:37

2 Answers2

4

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)))))))
unhammer
  • 1,127
  • 8
  • 22
mutbuerger
  • 3,434
  • 14
  • 22
1

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).

unhammer
  • 1,127
  • 8
  • 22