emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Clock-in task when emacs starts
@ 2011-04-12 10:11 Radosław Grzanka
  2011-04-12 13:31 ` Bernt Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Radosław Grzanka @ 2011-04-12 10:11 UTC (permalink / raw)
  To: Org-mode ml

Hello,
   is it possible to select and clock-in default task when emacs starts?

I'm trying to implement GTD setup as described here 
http://doc.norang.ca/org-mode.html and I like concept of "punching-in". 
However, I found out it is not necessary for me to select "default task" 
each time I punch in becaue I have only one such task.

Therefore, I'd like to set default task and clock it in when emacs starts.

Any help?

  Thanks,
   Radek.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Clock-in task when emacs starts
  2011-04-12 10:11 Clock-in task when emacs starts Radosław Grzanka
@ 2011-04-12 13:31 ` Bernt Hansen
  2011-04-13 11:20   ` Radosław Grzanka
  0 siblings, 1 reply; 3+ messages in thread
From: Bernt Hansen @ 2011-04-12 13:31 UTC (permalink / raw)
  To: radoslawg; +Cc: Org-mode ml

Radosław Grzanka <radoslawg@gmail.com> writes:

> Hello,
>   is it possible to select and clock-in default task when emacs starts?
>
> I'm trying to implement GTD setup as described here
> http://doc.norang.ca/org-mode.html and I like concept of
> "punching-in". However, I found out it is not necessary for me to
> select "default task" each time I punch in becaue I have only one such
> task.
>
> Therefore, I'd like to set default task and clock it in when emacs starts.
>
> Any help?
>
>  Thanks,
>   Radek.

Hi Radek,

Sure it is possible.  You can identify a task by a globally unique id
and clock that in.  I have a function for this but I don't use it
anymore.

I've modified the org-clock-in call to provide the double prefix
argument so it also sets this as the default task.

Now you can just call (bh/clock-in-organization-task) in your .emacs or
bind it to a key to set that task to the default.

--8<---------------cut here---------------start------------->8---
(require 'org-id)

(defun bh/clock-in-organization-task ()
  (interactive)
  (bh/clock-in-task-by-id "eb155a82-92b2-4f25-a3c6-0304591af2f9"))

(defun bh/clock-in-task-by-id (id)
  "Clock in a task by id"
  (save-restriction
    (widen)
    (org-with-point-at (org-id-find id 'marker)
      (org-clock-in '(16)))))
--8<---------------cut here---------------end--------------->8---

Regards,
Bernt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Clock-in task when emacs starts
  2011-04-12 13:31 ` Bernt Hansen
@ 2011-04-13 11:20   ` Radosław Grzanka
  0 siblings, 0 replies; 3+ messages in thread
From: Radosław Grzanka @ 2011-04-13 11:20 UTC (permalink / raw)
  Cc: Org-mode ml

> --8<---------------cut here---------------start------------->8---
> (require 'org-id)
>
> (defun bh/clock-in-organization-task ()
>    (interactive)
>    (bh/clock-in-task-by-id "eb155a82-92b2-4f25-a3c6-0304591af2f9"))
>
> (defun bh/clock-in-task-by-id (id)
>    "Clock in a task by id"
>    (save-restriction
>      (widen)
>      (org-with-point-at (org-id-find id 'marker)
>        (org-clock-in '(16)))))
> --8<---------------cut here---------------end--------------->8---

Thanks Bernt, that is so cool. In fact I conceived something simillar 
but it dependent on exact headline name. Your version is way more versilite.

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-13 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-12 10:11 Clock-in task when emacs starts Radosław Grzanka
2011-04-12 13:31 ` Bernt Hansen
2011-04-13 11:20   ` Radosław Grzanka

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