From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike McLean Subject: Re: Clock history as autocomplete? Date: Fri, 3 Apr 2015 06:36:18 -0400 Message-ID: References: <87oan5hach.fsf@wmi.amu.edu.pl> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01184098f67f560512cf85d7 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ydyxz-00047q-2C for emacs-orgmode@gnu.org; Fri, 03 Apr 2015 06:36:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ydyxu-00087X-AM for emacs-orgmode@gnu.org; Fri, 03 Apr 2015 06:36:47 -0400 Received: from pb-sasl1.int.icgroup.com ([208.72.237.25]:65263 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ydyxu-000874-5S for emacs-orgmode@gnu.org; Fri, 03 Apr 2015 06:36:42 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id A84C93D8FE for ; Fri, 3 Apr 2015 06:36:39 -0400 (EDT) Received: from pb-sasl1.int.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id A07053D8FD for ; Fri, 3 Apr 2015 06:36:39 -0400 (EDT) Received: from mail-ob0-f169.google.com (unknown [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 357983D8F9 for ; Fri, 3 Apr 2015 06:36:39 -0400 (EDT) Received: by obvd1 with SMTP id d1so167066022obv.0 for ; Fri, 03 Apr 2015 03:36:38 -0700 (PDT) In-Reply-To: <87oan5hach.fsf@wmi.amu.edu.pl> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Marcin Borkowski Cc: Org-Mode mailing list --089e01184098f67f560512cf85d7 Content-Type: text/plain; charset=UTF-8 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); Go to line; Refile to this heading; Clock In; Clock in and Goto; 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 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 > > --089e01184098f67f560512cf85d7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I get the general effect using Emacs Helm with some additi= onal commands as part of the helm definitions. My original idea was from Sa= cha Chua (=C2=A0http://sachachua.com/blog/2015/03/getting-he= lm-org-refile-clock-create-tasks/ ) but I didn't implement her stuf= f as written (in part I didn't conceptually merge capture/create with g= oto/refile/clock as she did). I went for simpler. I can call my=C2=A0mlm/he= lm-org-agenda-files-headings with=C2=A0(kbd "C-x c o"), use Helm = completion to find the right headline, and then Goto, Refile current headin= g 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)
=C2=A0 (save-window-excursion
=C2=A0 =C2=A0 (helm-o= rg-goto-marker marker)
=C2=A0 =C2=A0 (if (derived-mode-p 'org= -agenda-mode) (org-agenda-clock-in) (org-clock-in))
=C2=A0 =C2=A0= t))

(defun my/helm-org-clock-in-and-goto (marker)=
=C2=A0 (helm-org-goto-marker marker)
=C2=A0 (if (deriv= ed-mode-p 'org-agenda-mode) (org-agenda-clock-in) (org-clock-in)))

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


(defun mlm/helm-org-ag= enda-files-headings ()
=C2=A0 (interactive)
=C2=A0 (hel= m :sources (mlm/helm-source-org-headings-for-files (org-agenda-files))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 :candidate-number-limit 99999
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 :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 <= ;mbork@wmi.amu.ed= u.pl> wrote:
Hi there,

I use C-u C-c C-x C-i (selecting clocking task from the history) /all
the time/.=C2=A0 However, I would very much prefer entering the clocking ta= sk
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...).=C2=A0 Is that possible?

Best,

--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University


--089e01184098f67f560512cf85d7--