I get the general effect using Emacs Helm with some additional commands as
part of the helm definitions. My original idea was from Sacha Chua (
http://sachachua.com/blog/2015/03/getting-helm-org-refile-clock-create-tasks/
) but I didn't implement her stuff as written (in part I didn't
conceptually merge capture/create with goto/refile/clock as she did). I
went for simpler. I can call my mlm/helm-org-agenda-files-headings
with (kbd "C-x c o"), use Helm completion to find the right headline, and
then Goto, Refile current heading to, Clock In, Clock In and Goto, or
Insert Link


#+begin_src emacs-lisp :tangle "package-init/init-helm.el" :comments both
(defun my/helm-org-clock-in (marker)
  (save-window-excursion
    (helm-org-goto-marker marker)
    (if (derived-mode-p 'org-agenda-mode) (org-agenda-clock-in)
(org-clock-in))
    t))

(defun my/helm-org-clock-in-and-goto (marker)
  (helm-org-goto-marker marker)
  (if (derived-mode-p 'org-agenda-mode) (org-agenda-clock-in)
(org-clock-in)))

(cl-defun mlm/helm-source-org-headings-for-files (filenames
                                                  &optional (min-depth 1)
(max-depth 8))
  (helm-build-sync-source "Org Headings"
    :candidates (helm-org-get-candidates filenames min-depth max-depth)
    :persistent-help "Go to line (keeping session); <f1> Go to line; <f2>
Refile to this heading; <f3> Clock In; <f4> Clock in and Goto; <f5> Insert
link to this heading"
    :action '(("Go to line" . helm-org-goto-marker)
              ("Refile to this heading" . helm-org-heading-refile)
              ("Clock in" . my/helm-org-clock-in)
              ("Clock in and Go to" . my/helm-org-clock-in-and-goto)
              ("Insert link to this heading" .
helm-org-insert-link-to-heading-at-marker))))


(defun mlm/helm-org-agenda-files-headings ()
  (interactive)
  (helm :sources (mlm/helm-source-org-headings-for-files (org-agenda-files))
        :candidate-number-limit 99999
        :buffer "*helm org headings*"))

(global-set-key (kbd "C-x c o") 'mlm/helm-org-agenda-files-headings)
#+end_src


On Fri, Apr 3, 2015 at 4:42 AM, Marcin Borkowski <mb...@wmi.amu.edu.pl>
wrote:

> Hi there,
>
> I use C-u C-c C-x C-i (selecting clocking task from the history) /all
> the time/.  However, I would very much prefer entering the clocking task
> with autocompletion, from a longer history, or even all headings that
> already have a clock (I have (setq org-clock-history-length 20) in my
> init.el, and sometimes it's not enough...).  Is that possible?
>
> Best,
>
> --
> Marcin Borkowski
> http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
> Faculty of Mathematics and Computer Science
> Adam Mickiewicz University
>
>

Reply via email to