emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Automatic clock-in
@ 2010-04-19 14:47 Andrea Crotti
  2010-04-19 15:49 ` Benjamin Andresen
  2010-04-20  0:33 ` Bernt Hansen
  0 siblings, 2 replies; 8+ messages in thread
From: Andrea Crotti @ 2010-04-19 14:47 UTC (permalink / raw)
  To: emacs-orgmode

I'm using more and more the very nice clock functions provided by
org-mode.
I added this
--8<---------------cut here---------------start------------->8---
(global-set-key "\C-c\C-x\C-o" 'org-clock-out)
--8<---------------cut here---------------end--------------->8---

So I can clock out from every buffer without problems.
It would be nice somehow to have a similar thing for clock in also.
It's not so easy of course but most of the I clock in in the same buffer
that I last clocked out.

There could be a default choice which brings you there and otherwise
asks you to which buffer you want to clock in, something like that.

Or is there another better way to do already what I'm asking?

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

* Re: Automatic clock-in
  2010-04-19 14:47 Automatic clock-in Andrea Crotti
@ 2010-04-19 15:49 ` Benjamin Andresen
  2010-04-19 17:27   ` Eric S Fraga
  2010-04-20 12:51   ` Andrea Crotti
  2010-04-20  0:33 ` Bernt Hansen
  1 sibling, 2 replies; 8+ messages in thread
From: Benjamin Andresen @ 2010-04-19 15:49 UTC (permalink / raw)
  To: emacs-orgmode

Hey Andrea,

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> Or is there another better way to do already what I'm asking?

Maybe C-u M-x org-clock-in RET does what you want.

br,
benny

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

* Re: Re: Automatic clock-in
  2010-04-19 15:49 ` Benjamin Andresen
@ 2010-04-19 17:27   ` Eric S Fraga
  2010-04-20 12:51   ` Andrea Crotti
  1 sibling, 0 replies; 8+ messages in thread
From: Eric S Fraga @ 2010-04-19 17:27 UTC (permalink / raw)
  To: Benjamin Andresen; +Cc: emacs-orgmode

On Mon, 19 Apr 2010 17:49:09 +0200, Benjamin Andresen <benny@in-ulm.de> wrote:
> 
> Hey Andrea,
> 
> Andrea Crotti <andrea.crotti.0@gmail.com> writes:
> 
> > Or is there another better way to do already what I'm asking?
> 
> Maybe C-u M-x org-clock-in RET does what you want.

Andrea,

I tag all the jobs that I clock with :clocked: and then simply 

C-c a m clocked RET

to bring up an agenda view with all of these items.  Easy then to
simply clock in the one I want.  This, however, assumes that you have
a relatively small set of such jobs...  It does help that you can
TAB complete on the tag so I typically type C-c a m clo TAB

HTH,
eric

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

* Re: Automatic clock-in
  2010-04-19 14:47 Automatic clock-in Andrea Crotti
  2010-04-19 15:49 ` Benjamin Andresen
@ 2010-04-20  0:33 ` Bernt Hansen
  1 sibling, 0 replies; 8+ messages in thread
From: Bernt Hansen @ 2010-04-20  0:33 UTC (permalink / raw)
  To: Andrea Crotti; +Cc: emacs-orgmode

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> I'm using more and more the very nice clock functions provided by
> org-mode.
> I added this
> --8<---------------cut here---------------start------------->8---
> (global-set-key "\C-c\C-x\C-o" 'org-clock-out)
> --8<---------------cut here---------------end--------------->8---
>
> So I can clock out from every buffer without problems.
> It would be nice somehow to have a similar thing for clock in also.
> It's not so easy of course but most of the I clock in in the same buffer
> that I last clocked out.
>
> There could be a default choice which brings you there and otherwise
> asks you to which buffer you want to clock in, something like that.
>
> Or is there another better way to do already what I'm asking?

Hi Andrea,

I have a couple of tasks I regularly clock in (organization, and read
mail/news).  These I clock in by F9-o and F9-m respectively.  They look
up the task by id and clock it in no matter what buffer I am in.  I have
F9-O as org-clock-out.

F11 is bound to org-clock-goto and C-F11 bound to org-clock-in so I can
return to my last clocked task simply by pressing F11, or I can visit
any recently clocked task with C-u F11 and I can clock in any recently
clocked task with C-u C-F11.

I use this all the time without thinking about it anymore :)

More details are here:
http://doc.norang.ca/org-mode.html#KeyBindings
http://doc.norang.ca/org-mode.html#ClockSetup

Regards,
Bernt

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

* Re: Automatic clock-in
  2010-04-19 15:49 ` Benjamin Andresen
  2010-04-19 17:27   ` Eric S Fraga
@ 2010-04-20 12:51   ` Andrea Crotti
  2010-04-20 13:46     ` Eric S Fraga
                       ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Andrea Crotti @ 2010-04-20 12:51 UTC (permalink / raw)
  To: emacs-orgmode

Benjamin Andresen <benny@in-ulm.de> writes:

> Hey Andrea,
>
>
> Maybe C-u M-x org-clock-in RET does what you want.
>
> br,
> benny

Ah great that's really nice, I always forget to try the magic C-u
first...
So by the way what is the real function called when prefixing C-u?
I mean, can I call it directly?

I see that (universal-argument) is a function but it doesn't take any
argument actually...

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

* Re: Re: Automatic clock-in
  2010-04-20 12:51   ` Andrea Crotti
@ 2010-04-20 13:46     ` Eric S Fraga
  2010-04-20 14:50     ` Nick Dokos
  2010-04-20 14:57     ` Bastien
  2 siblings, 0 replies; 8+ messages in thread
From: Eric S Fraga @ 2010-04-20 13:46 UTC (permalink / raw)
  To: Andrea Crotti; +Cc: emacs-orgmode

On Tue, 20 Apr 2010 14:51:57 +0200, Andrea Crotti <andrea.crotti.0@gmail.com> wrote:
> Ah great that's really nice, I always forget to try the magic C-u
> first...
> So by the way what is the real function called when prefixing C-u?
> I mean, can I call it directly?

The same function (i.e. org-clock-in in this case) except that an
argument is passed to it.  You can see from the definition of org-clock-in:

,----
| (defun org-clock-in (&optional select)
|   "Start the clock on the current item.
| If necessary, clock-out of the currently active clock.
| With prefix arg SELECT, offer a list of recently clocked tasks to
| clock into.  When SELECT is `C-u C-u', clock into the current task and mark
| is as the default task, a special task that will always be offered in
| the clocking selection, associated with the letter `d'."
`----

that there is an optional argument called "select" which will be
defined if you use C-u or C-u C-u as the documentation says.

HTH,
eric

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

* Re: Re: Automatic clock-in
  2010-04-20 12:51   ` Andrea Crotti
  2010-04-20 13:46     ` Eric S Fraga
@ 2010-04-20 14:50     ` Nick Dokos
  2010-04-20 14:57     ` Bastien
  2 siblings, 0 replies; 8+ messages in thread
From: Nick Dokos @ 2010-04-20 14:50 UTC (permalink / raw)
  To: Andrea Crotti; +Cc: nicholas.dokos, emacs-orgmode

Andrea Crotti <andrea.crotti.0@gmail.com> wrote:

> Benjamin Andresen <benny@in-ulm.de> writes:
> 
> > Hey Andrea,
> >
> >
> > Maybe C-u M-x org-clock-in RET does what you want.
> >
> > br,
> > benny
> 
> Ah great that's really nice, I always forget to try the magic C-u
> first...
> So by the way what is the real function called when prefixing C-u?

The same function is called, but with the optional SELECT argument set.
C-h f org-clock-in says:

,----
| org-clock-in is an interactive compiled Lisp function in
| `org-clock.el'.
| 
| (org-clock-in &optional SELECT)
| 
| Start the clock on the current item.
| If necessary, clock-out of the currently active clock.
| With prefix arg SELECT, offer a list of recently clocked tasks to
| clock into.  When SELECT is `C-u C-u', clock into the current task and mark
| is as the default task, a special task that will always be offered in
| the clocking selection, associated with the letter `d'.
`----

> I mean, can I call it directly?
> 

You mean from lisp code? You call it like this:

    (org-clock-in 4)

(that's what C-u M-x org-clock-in does), or

    (org-clock-in 16)

(that's what C-u C-u M-x org-clock-in does.)

And, btw, that's what C-u and C-u C-u do *always*: see section 7.10,
Numeric Arguments, in the Emacs manual.

HTH,
Nick

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

* Re: Re: Automatic clock-in
  2010-04-20 12:51   ` Andrea Crotti
  2010-04-20 13:46     ` Eric S Fraga
  2010-04-20 14:50     ` Nick Dokos
@ 2010-04-20 14:57     ` Bastien
  2 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2010-04-20 14:57 UTC (permalink / raw)
  To: Andrea Crotti; +Cc: emacs-orgmode

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> Ah great that's really nice, I always forget to try the magic C-u
> first...
> So by the way what is the real function called when prefixing C-u?
> I mean, can I call it directly?

For example:

(define-key org-mode-map "\C-c\C-x\C-I"
  (lambda () (interactive) (org-clock-in '(4))))

-- 
 Bastien

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

end of thread, other threads:[~2010-04-20 15:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-19 14:47 Automatic clock-in Andrea Crotti
2010-04-19 15:49 ` Benjamin Andresen
2010-04-19 17:27   ` Eric S Fraga
2010-04-20 12:51   ` Andrea Crotti
2010-04-20 13:46     ` Eric S Fraga
2010-04-20 14:50     ` Nick Dokos
2010-04-20 14:57     ` Bastien
2010-04-20  0:33 ` Bernt Hansen

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