all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Capture - stay clocked in?
@ 2011-02-28 19:30 Nathan Neff
  2011-02-28 22:40 ` Bernt Hansen
  2011-03-06  0:13 ` Bastien
  0 siblings, 2 replies; 18+ messages in thread
From: Nathan Neff @ 2011-02-28 19:30 UTC (permalink / raw)
  To: emacs-orgmode

Is there an option NOT to clock out of a Todo item that's
created using org-capture?

I would like to use capture templates to define a new TODO task, and
just stay clocked in to the new TODO.

Thanks,
--Nate

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

* Re: Capture - stay clocked in?
  2011-02-28 19:30 Capture - stay clocked in? Nathan Neff
@ 2011-02-28 22:40 ` Bernt Hansen
  2011-03-06  0:13 ` Bastien
  1 sibling, 0 replies; 18+ messages in thread
From: Bernt Hansen @ 2011-02-28 22:40 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

Nathan Neff <nathan.neff@gmail.com> writes:

> Is there an option NOT to clock out of a Todo item that's
> created using org-capture?
>
> I would like to use capture templates to define a new TODO task, and
> just stay clocked in to the new TODO.

I don't think there is an out-of-the-box way to do this today.  You can
add a hook to org-clock-out-hook that checks if you are completing a
capture and clock that task in again.  This might work okay if you
always want to do that.

My solution to this problem is just to clock in the interrupted task
again with F9-SPC.  Capture clocks in the capture task and clocks out
when it is filed, and the following function switches the clock back to
the last (captured) task.

--8<---------------cut here---------------start------------->8---
(global-set-key (kbd "<f9> SPC") 'bh/clock-in-last-task)

(defun bh/clock-in-last-task ()
  "Clock in the interrupted task if there is one
Skip the default task and get the next one"
  (interactive)
  (let ((clock-in-to-task (if (org-clock-is-active)
			      (if (equal org-clock-default-task (cadr org-clock-history))
				  (caddr org-clock-history)
				(cadr org-clock-history))
			    (if (equal org-clock-default-task (car org-clock-history))
				(cadr org-clock-history)
			      (car org-clock-history)))))
    (org-with-point-at clock-in-to-task
      (org-clock-in nil))))

--8<---------------cut here---------------end--------------->8---

Regards,
Bernt

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

* Re: Capture - stay clocked in?
  2011-02-28 19:30 Capture - stay clocked in? Nathan Neff
  2011-02-28 22:40 ` Bernt Hansen
@ 2011-03-06  0:13 ` Bastien
  2011-03-07  3:35   ` Bernt Hansen
  1 sibling, 1 reply; 18+ messages in thread
From: Bastien @ 2011-03-06  0:13 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

Hi Nathan,

Nathan Neff <nathan.neff@gmail.com> writes:

> Is there an option NOT to clock out of a Todo item that's
> created using org-capture?

I assume you mean "when :immediate-finish is non-nil in a capture
template", right?

Yes, this bugged me as well.  

The default behavior is now (latest git) that :immediate-finish t 
will *not* clock out the captured entry so that you can use it in
conjunction with :clock-in.

HTH,

-- 
 Bastien

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

* Re: Capture - stay clocked in?
  2011-03-06  0:13 ` Bastien
@ 2011-03-07  3:35   ` Bernt Hansen
  2011-03-07  8:23     ` Bastien
  2011-03-07 10:17     ` Bastien
  0 siblings, 2 replies; 18+ messages in thread
From: Bernt Hansen @ 2011-03-07  3:35 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Hi Nathan,
>
> Nathan Neff <nathan.neff@gmail.com> writes:
>
>> Is there an option NOT to clock out of a Todo item that's
>> created using org-capture?
>
> I assume you mean "when :immediate-finish is non-nil in a capture
> template", right?
>
> Yes, this bugged me as well.  
>
> The default behavior is now (latest git) that :immediate-finish t 
> will *not* clock out the captured entry so that you can use it in
> conjunction with :clock-in.
>
> HTH,

Hi Bastien,

I think this change may have changed the default for
non :immediate-finish capture tasks as well.

I have the following template:

--8<---------------cut here---------------start------------->8---
("t" "todo" entry
  (file "~/git/org/refile.org")
  "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
--8<---------------cut here---------------end--------------->8---

and if the clock is not running when I start capture with this template
it stays running afterwards.  I don't think this was the intended
behaviour.

Let me know if you want me to try to isolate the commit that changed
this behaviour for me.

Thanks,
-- 
Bernt

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

* Re: Capture - stay clocked in?
  2011-03-07  3:35   ` Bernt Hansen
@ 2011-03-07  8:23     ` Bastien
  2011-03-07 10:20       ` Giovanni Ridolfi
  2011-03-07 10:17     ` Bastien
  1 sibling, 1 reply; 18+ messages in thread
From: Bastien @ 2011-03-07  8:23 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

Bernt Hansen <bernt@norang.ca> writes:

> I think this change may have changed the default for
> non :immediate-finish capture tasks as well.
>
> I have the following template:
>
> ("t" "todo" entry
>   (file "~/git/org/refile.org")
>   "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
>
> and if the clock is not running when I start capture with this template
> it stays running afterwards.  I don't think this was the intended
> behaviour.

I see.  

My first idea was to implement a new template option :immediate-refile
(or a similar name).  :immediate-finish would stick to the old behavior
(no clocking allowed) and :immediate-refile would leave the clock open.

But I thought this was potentially confusing.

What about :clock-out t, explicitely telling org-capture-finalize to
clock out when?

-- 
 Bastien

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

* Re: Capture - stay clocked in?
  2011-03-07  3:35   ` Bernt Hansen
  2011-03-07  8:23     ` Bastien
@ 2011-03-07 10:17     ` Bastien
  2011-03-07 12:34       ` Bernt Hansen
  1 sibling, 1 reply; 18+ messages in thread
From: Bastien @ 2011-03-07 10:17 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

Bernt Hansen <bernt@norang.ca> writes:

> I think this change may have changed the default for
> non :immediate-finish capture tasks as well.

I finally introduced a new template option :no-clock-out which, 
when set to t, will prevent the clocking-out when filing an entry.

This way the old behavior is kept, it shouldn't break current
configuration.

Thanks for bringing this up!

Best,

-- 
 Bastien

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

* Re: Capture - stay clocked in?
  2011-03-07  8:23     ` Bastien
@ 2011-03-07 10:20       ` Giovanni Ridolfi
  2011-03-07 10:26         ` Bastien
  0 siblings, 1 reply; 18+ messages in thread
From: Giovanni Ridolfi @ 2011-03-07 10:20 UTC (permalink / raw)
  To: Bastien; +Cc: Bernt Hansen, emacs-orgmode

Bastien <bzg@altern.org> writes:

>
> What about :clock-out t, explicitely telling org-capture-finalize to
> clock out when?

Oh, yes, please[1]!

cheers,
Giovanni

[1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00099.html

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

* Re: Capture - stay clocked in?
  2011-03-07 10:20       ` Giovanni Ridolfi
@ 2011-03-07 10:26         ` Bastien
  2011-03-07 12:54           ` Carsten Dominik
  0 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2011-03-07 10:26 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: Bernt Hansen, emacs-orgmode

Hi Giovanni,

Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:

> Bastien <bzg@altern.org> writes:
>
>>
>> What about :clock-out t, explicitely telling org-capture-finalize to
>> clock out when?
>
> Oh, yes, please[1]!

See my previous message -- I used :no-clock-out to stick to the default
behavior and avoid users to have to change their config.  Let me know if
this is okay for you!

Thanks,

-- 
 Bastien

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

* Re: Capture - stay clocked in?
  2011-03-07 10:17     ` Bastien
@ 2011-03-07 12:34       ` Bernt Hansen
  0 siblings, 0 replies; 18+ messages in thread
From: Bernt Hansen @ 2011-03-07 12:34 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>
>> I think this change may have changed the default for
>> non :immediate-finish capture tasks as well.
>
> I finally introduced a new template option :no-clock-out which, 
> when set to t, will prevent the clocking-out when filing an entry.
>
> This way the old behavior is kept, it shouldn't break current
> configuration.
>
> Thanks for bringing this up!

Hi Bastien,

Thanks, I'll check this out today and report back if I notice any
issues.

Regards,
-- 
Bernt

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

* Re: Capture - stay clocked in?
  2011-03-07 10:26         ` Bastien
@ 2011-03-07 12:54           ` Carsten Dominik
  2011-03-07 13:51             ` Bernt Hansen
  2011-03-07 14:45             ` Bastien
  0 siblings, 2 replies; 18+ messages in thread
From: Carsten Dominik @ 2011-03-07 12:54 UTC (permalink / raw)
  To: Bastien; +Cc: Bernt Hansen, emacs-orgmode


On Mar 7, 2011, at 11:26 AM, Bastien wrote:

> Hi Giovanni,
> 
> Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:
> 
>> Bastien <bzg@altern.org> writes:
>> 
>>> 
>>> What about :clock-out t, explicitely telling org-capture-finalize to
>>> clock out when?
>> 
>> Oh, yes, please[1]!
> 
> See my previous message -- I used :no-clock-out to stick to the default
> behavior and avoid users to have to change their config.  Let me know if
> this is okay for you!

I like this decision, because of the templates is asked to clock
in, it seems natural for me that it will clock out when it is done.

This only suggestion I would have is it maybe call the property
:clock-keep-running.  No sure though.

Also, this new property, when set, does not allow :clock-resume,
I have not checked if something bad would happen should a user
give both by accident.

Kind regards

- Carsten

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

* Re: Capture - stay clocked in?
  2011-03-07 12:54           ` Carsten Dominik
@ 2011-03-07 13:51             ` Bernt Hansen
  2011-03-07 14:44               ` Bastien
  2011-03-07 14:45             ` Bastien
  1 sibling, 1 reply; 18+ messages in thread
From: Bernt Hansen @ 2011-03-07 13:51 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bastien, emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Mar 7, 2011, at 11:26 AM, Bastien wrote:
>
>> Hi Giovanni,
>> 
>> Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:
>> 
>>> Bastien <bzg@altern.org> writes:
>>> 
>>>> 
>>>> What about :clock-out t, explicitely telling org-capture-finalize to
>>>> clock out when?
>>> 
>>> Oh, yes, please[1]!
>> 
>> See my previous message -- I used :no-clock-out to stick to the default
>> behavior and avoid users to have to change their config.  Let me know if
>> this is okay for you!
>
> I like this decision, because of the templates is asked to clock
> in, it seems natural for me that it will clock out when it is done.
>
> This only suggestion I would have is it maybe call the property
> :clock-keep-running.  No sure though.
>
> Also, this new property, when set, does not allow :clock-resume,
> I have not checked if something bad would happen should a user
> give both by accident.

This probably needs to be explicitly documented on what the behaviour
is.  I think it could easily go both ways - :no-clock-out would be true
whether you resume the clock or not so we need to state what the
behaviour is explicitly.

If it doesn't make sense to have both :no-clock-out and :clock-resume
then maybe the code could check for that and issue an error/warning
when the template is selected?

Maybe use :clock-keep instead of :no-clock-out (to indicate that we keep
the clock running in this capture task?) and state that if you
use :clock-keep then :clock-resume is ignored.

I'm not sure what wording is best for this property.

Regards,
-- 
Bernt

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

* Re: Capture - stay clocked in?
  2011-03-07 13:51             ` Bernt Hansen
@ 2011-03-07 14:44               ` Bastien
  0 siblings, 0 replies; 18+ messages in thread
From: Bastien @ 2011-03-07 14:44 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik

Hi Bernt,

Bernt Hansen <bernt@norang.ca> writes:

> If it doesn't make sense to have both :no-clock-out and :clock-resume
> then maybe the code could check for that and issue an error/warning
> when the template is selected?

Done.

> Maybe use :clock-keep instead of :no-clock-out (to indicate that we keep
> the clock running in this capture task?) and state that if you
> use :clock-keep then :clock-resume is ignored.

I find :clock-keep to be the better choice here, I took this one.

Thanks for the feedback and the ideas!

-- 
 Bastien

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

* Re: Capture - stay clocked in?
  2011-03-07 12:54           ` Carsten Dominik
  2011-03-07 13:51             ` Bernt Hansen
@ 2011-03-07 14:45             ` Bastien
  2011-03-07 15:20               ` Bernt Hansen
  1 sibling, 1 reply; 18+ messages in thread
From: Bastien @ 2011-03-07 14:45 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bernt Hansen, emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Also, this new property, when set, does not allow :clock-resume,
> I have not checked if something bad would happen should a user
> give both by accident.

Ah yes, thanks for bringing this up: :clock-keep has precedence 
over :clock-resume -- when both are non-nil, :clock-resume will
be discarded.   I mentioned this in the manual.

Thanks!

-- 
 Bastien

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

* Re: Capture - stay clocked in?
  2011-03-07 14:45             ` Bastien
@ 2011-03-07 15:20               ` Bernt Hansen
  2011-03-07 15:28                 ` Bastien
  0 siblings, 1 reply; 18+ messages in thread
From: Bernt Hansen @ 2011-03-07 15:20 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Carsten Dominik

Bastien <bzg@altern.org> writes:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> Also, this new property, when set, does not allow :clock-resume,
>> I have not checked if something bad would happen should a user
>> give both by accident.
>
> Ah yes, thanks for bringing this up: :clock-keep has precedence 
> over :clock-resume -- when both are non-nil, :clock-resume will
> be discarded.   I mentioned this in the manual.

For my 't' capture template with :clock-in and :clock-resume (and
no :clock-keep) when I start capture mode for the task when the clock is
not running it stays running in that task (as reported earlier) - Isn't
that a bug?

Thanks,
-- 
Bernt

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

* Re: Capture - stay clocked in?
  2011-03-07 15:20               ` Bernt Hansen
@ 2011-03-07 15:28                 ` Bastien
  2011-03-07 15:55                   ` Bernt Hansen
  0 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2011-03-07 15:28 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik

Bernt Hansen <bernt@norang.ca> writes:

> For my 't' capture template with :clock-in and :clock-resume (and
> no :clock-keep) when I start capture mode for the task when the clock is
> not running it stays running in that task (as reported earlier) - Isn't
> that a bug?

Is it against latest git?  (I pushed the change a bit later than I
announced it.)  

Could you share you template so that I can test?

Thanks,

-- 
 Bastien

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

* Re: Capture - stay clocked in?
  2011-03-07 15:28                 ` Bastien
@ 2011-03-07 15:55                   ` Bernt Hansen
  2011-03-07 16:27                     ` Bastien
  0 siblings, 1 reply; 18+ messages in thread
From: Bernt Hansen @ 2011-03-07 15:55 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Carsten Dominik

Bastien <bzg@altern.org> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>
>> For my 't' capture template with :clock-in and :clock-resume (and
>> no :clock-keep) when I start capture mode for the task when the clock is
>> not running it stays running in that task (as reported earlier) - Isn't
>> that a bug?
>
> Is it against latest git?  (I pushed the change a bit later than I
> announced it.)  
>
> Could you share you template so that I can test?

Yes it's from Org-mode version 7.5 (release_7.5.3.g7cb08)
GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-11
on raven, modified by Debian

I see two problems with this capture:

 1) Clock stays running in the capture task after C-c C-c
 2) The refile.org capture buffer is narrowed hiding the newly captured
    task

Here is the sequence to reproduce the problem.

Start emacs with 
--8<---------------cut here---------------start------------->8---
$ minimal-emacs
--8<---------------cut here---------------end--------------->8---


| Key           | Notes                   |
| C-c c         | Start capture mode      |
| t             | select TODO template    |
| test clocking | give the task a heading |
| C-c C-c       | close capture template  |

The clock is still running.  If you visit the file with C-x C-f
/tmp/refile.org it looks empty because it is currently narrowed.

Regards,
Bernt

~/bin/minimal-emacs
--8<---------------cut here---------------start------------->8---
#!/bin/sh
TESTEL=
TESTFILE=/tmp/test.el
if test -e $TESTFILE
then
  TESTEL="-l /tmp/test.el"
fi
emacs -q -l ~/minimal.emacs $TESTEL $1
--8<---------------cut here---------------end--------------->8---

~/minimal.emacs
--8<---------------cut here---------------start------------->8---
(add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org-install)

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
--8<---------------cut here---------------end--------------->8---

/tmp/test.el
--8<---------------cut here---------------start------------->8---
(setq org-capture-templates (quote (("t" "todo" entry (file "/tmp/refile.org") "* TODO %?
%U
%a
" :clock-in t :clock-resume t))))
(global-set-key (kbd "C-c c") 'org-capture)
--8<---------------cut here---------------end--------------->8---

-- 
Bernt

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

* Re: Capture - stay clocked in?
  2011-03-07 15:55                   ` Bernt Hansen
@ 2011-03-07 16:27                     ` Bastien
  2011-03-07 18:13                       ` Bernt Hansen
  0 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2011-03-07 16:27 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik

Hi Bernt,

Bernt Hansen <bernt@norang.ca> writes:

> I see two problems with this capture:
>
>  1) Clock stays running in the capture task after C-c C-c

I pushed a fix for this.  

Thanks for the minimal.emacs and the detailed report.

>  2) The refile.org capture buffer is narrowed hiding the newly captured
>     task

Certainly a bug when refiling to empty buffers, where the check I use to
see if the buffer is already narrowed doesn't work properly.

I'll check this out.

Thanks!

-- 
 Bastien

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

* Re: Capture - stay clocked in?
  2011-03-07 16:27                     ` Bastien
@ 2011-03-07 18:13                       ` Bernt Hansen
  0 siblings, 0 replies; 18+ messages in thread
From: Bernt Hansen @ 2011-03-07 18:13 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Carsten Dominik

Bastien <bzg@altern.org> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>
>> I see two problems with this capture:
>>
>>  1) Clock stays running in the capture task after C-c C-c
>
> I pushed a fix for this.  
>
> Thanks for the minimal.emacs and the detailed report.

Hi Bastien,

Thanks.  This works now.

>
>>  2) The refile.org capture buffer is narrowed hiding the newly captured
>>     task
>
> Certainly a bug when refiling to empty buffers, where the check I use to
> see if the buffer is already narrowed doesn't work properly.
>
> I'll check this out.

Great!  Thanks for all your hard work!

Regards,
-- 
Bernt

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

end of thread, other threads:[~2011-03-07 18:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-28 19:30 Capture - stay clocked in? Nathan Neff
2011-02-28 22:40 ` Bernt Hansen
2011-03-06  0:13 ` Bastien
2011-03-07  3:35   ` Bernt Hansen
2011-03-07  8:23     ` Bastien
2011-03-07 10:20       ` Giovanni Ridolfi
2011-03-07 10:26         ` Bastien
2011-03-07 12:54           ` Carsten Dominik
2011-03-07 13:51             ` Bernt Hansen
2011-03-07 14:44               ` Bastien
2011-03-07 14:45             ` Bastien
2011-03-07 15:20               ` Bernt Hansen
2011-03-07 15:28                 ` Bastien
2011-03-07 15:55                   ` Bernt Hansen
2011-03-07 16:27                     ` Bastien
2011-03-07 18:13                       ` Bernt Hansen
2011-03-07 10:17     ` Bastien
2011-03-07 12:34       ` Bernt Hansen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.