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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.