emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mike McLean <mike.mclean@pobox.com>
To: Marcin Borkowski <mbork@wmi.amu.edu.pl>
Cc: Org-Mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Clock history as autocomplete?
Date: Fri, 3 Apr 2015 06:36:18 -0400	[thread overview]
Message-ID: <CANid5Q6xEiw0C2rDbvFefHWO60M5PmWpR=zKvd-qF-FfSbkD7A@mail.gmail.com> (raw)
In-Reply-To: <87oan5hach.fsf@wmi.amu.edu.pl>

[-- Attachment #1: Type: text/plain, Size: 2678 bytes --]

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 <mbork@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
>
>

[-- Attachment #2: Type: text/html, Size: 3914 bytes --]

  reply	other threads:[~2015-04-03 10:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-03  8:42 Clock history as autocomplete? Marcin Borkowski
2015-04-03 10:36 ` Mike McLean [this message]
2015-04-03 14:02   ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANid5Q6xEiw0C2rDbvFefHWO60M5PmWpR=zKvd-qF-FfSbkD7A@mail.gmail.com' \
    --to=mike.mclean@pobox.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mbork@wmi.amu.edu.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).