Re: [O] Prompt for time when clocking in?

2011-10-20 Thread Nathan Neff
Some progress --

I used Nick's suggestion combined with the org-read-date function.

This is my first attempt -- It will prompt you for a time, and clock
in to the headline that the cursor is on with that time.

(defun njn/clock-in-at-time()
   (interactive)
(setq start-time (org-read-date 't 't))
(org-clock-in nil start-time)
)

It's a bit wonky if you clock in to a past time, and then you want to
resolve that clock, but my main use-case for now is this:

1) I start doing something
2) I forgot to clock in
3) I don't want to press 8 keys in order to clock in 15 minutes ago.

This solution should work for now.  Although, I could see it being a
handy way to
prompt for clock-in *and* clock-out times.

Thanks for the suggestions,

--Nate

On Wed, Oct 19, 2011 at 10:35 AM, Nick Dokos nicholas.do...@hp.com wrote:
 John Hendy jw.he...@gmail.com wrote:

 On Wed, Oct 19, 2011 at 9:54 AM, Nathan Neff nathan.n...@gmail.com wrote:
  Is there a way to pull up a date/time prompt when clocking in to a task?
 
  Sometimes, I started a task 15 minutes ago, and have to go through the 
  following
  steps:
 
  1) clock in on the task,
  2) Go to the CLOCK section for that header and press tab to open it
  3) Fix the clock-in time
 
  If it's not built in, does anyone have any slick functions that would 
  accomplish
  the same thing? :-)

 Check out a thread I started a bit back on this exact topic:
 --- http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40498.html

 It wasn't exactly what I expected, the suggestion by Bernt for `M-x
 org-resolve-clocks` works reasonably well if you are trying to clock
 back-to-back activities. Post back after you read that perhaps? Maybe
 you'll find something helpful.


 org-clock-in takes an optional start-time argument which is used instead
 of the current time when non-nil. So I tried

 (setq ct (current-time))
 (setq start-time (cons (car ct) (list (- (cadr ct) 900) (caddr ct

 and started a clock on a task with

 ESC ESC : (org-clock-in nil start-time)

 and it got clocked in 15 minutes before the current time.

 Now I don't propose this as a good UI :-), but it would require just a
 small wrapper for it to dtrt.

 HTH,
 Nick






Re: [O] Prompt for time when clocking in?

2011-10-20 Thread Nick Dokos
Nathan Neff nathan.n...@gmail.com wrote:

 Some progress --
 
 I used Nick's suggestion combined with the org-read-date function.
 
 This is my first attempt -- It will prompt you for a time, and clock
 in to the headline that the cursor is on with that time.
 
 (defun njn/clock-in-at-time()
(interactive)
 (setq start-time (org-read-date 't 't))
 (org-clock-in nil start-time)
 )
 

Two minor nits: t is a constant so you don't need to quote it; emacs-lisp
mode helps with indentation (putting it in a code block - see below -
in an org file and using C-c ' to edit it works wonderfully).

I'm not sure whether 'tis better to specify relative or absolute times
(let's see: I should have clocked in 15 mins ago vs Let's see: I
should have clocked in at 12:20), but just in case you want to try the
alternatives, here are two dummy function functions for the two
alternatives - they just print the result time in the echo area.

The rel time can use a prefix arg (ESC -15 M-x
rel/dummy-clock-in-at-time) or the minibuffer if no prefix arg is
specified (and you might want to bias it towards the past, so 15 = 15
mins ago and -15 = 15 mins from now, but that might be a bit
perverse).

FWIW, I think I would tend to prefer your implementation, but since I
clock nothing, I'm no expert :-)

Nick

#+begin_src elisp

(defun rel/dummy-clock-in-at-time (nmin)
  (interactive N+/-minutes: )
  (setq start-time (time-add (current-time) (seconds-to-time (* nmin 60
  (message (format-time-string %H:%M:%S start-time)))

(defun abs/dummy-clock-in-at-time()
  (interactive)
  (setq start-time (org-read-date t t))
  (message (format-time-string %H:%M:%S start-time)))

#+end_src



 It's a bit wonky if you clock in to a past time, and then you want to
 resolve that clock, but my main use-case for now is this:
 
 1) I start doing something
 2) I forgot to clock in
 3) I don't want to press 8 keys in order to clock in 15 minutes ago.
 
 This solution should work for now.  Although, I could see it being a
 handy way to
 prompt for clock-in *and* clock-out times.
 
 Thanks for the suggestions,
 
 --Nate
 
 On Wed, Oct 19, 2011 at 10:35 AM, Nick Dokos nicholas.do...@hp.com wrote:
  John Hendy jw.he...@gmail.com wrote:
 
  On Wed, Oct 19, 2011 at 9:54 AM, Nathan Neff nathan.n...@gmail.com wrote:
   Is there a way to pull up a date/time prompt when clocking in to a task?
  
   Sometimes, I started a task 15 minutes ago, and have to go through the 
   following
   steps:
  
   1) clock in on the task,
   2) Go to the CLOCK section for that header and press tab to open it
   3) Fix the clock-in time
  
   If it's not built in, does anyone have any slick functions that would 
   accomplish
   the same thing? :-)
 
  Check out a thread I started a bit back on this exact topic:
  --- http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40498.html
 
  It wasn't exactly what I expected, the suggestion by Bernt for `M-x
  org-resolve-clocks` works reasonably well if you are trying to clock
  back-to-back activities. Post back after you read that perhaps? Maybe
  you'll find something helpful.
 
 
  org-clock-in takes an optional start-time argument which is used instead
  of the current time when non-nil. So I tried
 
  (setq ct (current-time))
  (setq start-time (cons (car ct) (list (- (cadr ct) 900) (caddr ct
 
  and started a clock on a task with
 
  ESC ESC : (org-clock-in nil start-time)
 
  and it got clocked in 15 minutes before the current time.
 
  Now I don't propose this as a good UI :-), but it would require just a
  small wrapper for it to dtrt.
 
  HTH,
  Nick
 
 
 
 



Re: [O] Prompt for time when clocking in?

2011-10-20 Thread Nathan Neff
 Two minor nits: t is a constant so you don't need to quote it; emacs-lisp
 mode helps with indentation (putting it in a code block - see below -
 in an org file and using C-c ' to edit it works wonderfully).

Thanks for your suggestions re: using Emacs to edit
lisp code and using the t in lieu of 't -- I appreciate these types
of style/coding comments immensely!


 I'm not sure whether 'tis better to specify relative or absolute times
 (let's see: I should have clocked in 15 mins ago vs Let's see: I
 should have clocked in at 12:20), but just in case you want to try the
 alternatives, here are two dummy function functions for the two
 alternatives - they just print the result time in the echo area.

Nick, I like the ability to just type 15, but I also like the
ability to use the
familiar org-calendar in case I want to get fancier (for example, I
forgot to clock
something that I worked on yesterday)

It would be a cool feature of org-read-date to be able to type -15M
and have org-read-date go back 15 minutes from the current date/time.
I played around with org-read date for something like -15m and
-15M, but the -15m went back 15 *months*, not minutes.

Does anyone know if there's a way to specify a relative *time* using
org-read-date?  For example, something like -15M would be 15 minutes
earlier?

Thanks,
--Nate

 The rel time can use a prefix arg (ESC -15 M-x
 rel/dummy-clock-in-at-time) or the minibuffer if no prefix arg is
 specified (and you might want to bias it towards the past, so 15 = 15
 mins ago and -15 = 15 mins from now, but that might be a bit
 perverse).

 FWIW, I think I would tend to prefer your implementation, but since I
 clock nothing, I'm no expert :-)

 Nick

 #+begin_src elisp

 (defun rel/dummy-clock-in-at-time (nmin)
  (interactive N+/-minutes: )
  (setq start-time (time-add (current-time) (seconds-to-time (* nmin 60
  (message (format-time-string %H:%M:%S start-time)))

 (defun abs/dummy-clock-in-at-time()
  (interactive)
  (setq start-time (org-read-date t t))
  (message (format-time-string %H:%M:%S start-time)))

 #+end_src



 It's a bit wonky if you clock in to a past time, and then you want to
 resolve that clock, but my main use-case for now is this:

 1) I start doing something
 2) I forgot to clock in
 3) I don't want to press 8 keys in order to clock in 15 minutes ago.

 This solution should work for now.  Although, I could see it being a
 handy way to
 prompt for clock-in *and* clock-out times.

 Thanks for the suggestions,

 --Nate

 On Wed, Oct 19, 2011 at 10:35 AM, Nick Dokos nicholas.do...@hp.com wrote:
  John Hendy jw.he...@gmail.com wrote:
 
  On Wed, Oct 19, 2011 at 9:54 AM, Nathan Neff nathan.n...@gmail.com 
  wrote:
   Is there a way to pull up a date/time prompt when clocking in to a task?
  
   Sometimes, I started a task 15 minutes ago, and have to go through the 
   following
   steps:
  
   1) clock in on the task,
   2) Go to the CLOCK section for that header and press tab to open it
   3) Fix the clock-in time
  
   If it's not built in, does anyone have any slick functions that would 
   accomplish
   the same thing? :-)
 
  Check out a thread I started a bit back on this exact topic:
  --- http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40498.html
 
  It wasn't exactly what I expected, the suggestion by Bernt for `M-x
  org-resolve-clocks` works reasonably well if you are trying to clock
  back-to-back activities. Post back after you read that perhaps? Maybe
  you'll find something helpful.
 
 
  org-clock-in takes an optional start-time argument which is used instead
  of the current time when non-nil. So I tried
 
  (setq ct (current-time))
  (setq start-time (cons (car ct) (list (- (cadr ct) 900) (caddr ct
 
  and started a clock on a task with
 
  ESC ESC : (org-clock-in nil start-time)
 
  and it got clocked in 15 minutes before the current time.
 
  Now I don't propose this as a good UI :-), but it would require just a
  small wrapper for it to dtrt.
 
  HTH,
  Nick
 
 
 





[O] Prompt for time when clocking in?

2011-10-19 Thread Nathan Neff
Is there a way to pull up a date/time prompt when clocking in to a task?

Sometimes, I started a task 15 minutes ago, and have to go through the following
steps:

1) clock in on the task,
2) Go to the CLOCK section for that header and press tab to open it
3) Fix the clock-in time

If it's not built in, does anyone have any slick functions that would accomplish
the same thing? :-)

Thanks,
--Nate



Re: [O] Prompt for time when clocking in?

2011-10-19 Thread John Hendy
On Wed, Oct 19, 2011 at 9:54 AM, Nathan Neff nathan.n...@gmail.com wrote:
 Is there a way to pull up a date/time prompt when clocking in to a task?

 Sometimes, I started a task 15 minutes ago, and have to go through the 
 following
 steps:

 1) clock in on the task,
 2) Go to the CLOCK section for that header and press tab to open it
 3) Fix the clock-in time

 If it's not built in, does anyone have any slick functions that would 
 accomplish
 the same thing? :-)

Check out a thread I started a bit back on this exact topic:
--- http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40498.html

It wasn't exactly what I expected, the suggestion by Bernt for `M-x
org-resolve-clocks` works reasonably well if you are trying to clock
back-to-back activities. Post back after you read that perhaps? Maybe
you'll find something helpful.

John



 Thanks,
 --Nate





Re: [O] Prompt for time when clocking in?

2011-10-19 Thread Nick Dokos
John Hendy jw.he...@gmail.com wrote:

 On Wed, Oct 19, 2011 at 9:54 AM, Nathan Neff nathan.n...@gmail.com wrote:
  Is there a way to pull up a date/time prompt when clocking in to a task?
 
  Sometimes, I started a task 15 minutes ago, and have to go through the 
  following
  steps:
 
  1) clock in on the task,
  2) Go to the CLOCK section for that header and press tab to open it
  3) Fix the clock-in time
 
  If it's not built in, does anyone have any slick functions that would 
  accomplish
  the same thing? :-)
 
 Check out a thread I started a bit back on this exact topic:
 --- http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40498.html
 
 It wasn't exactly what I expected, the suggestion by Bernt for `M-x
 org-resolve-clocks` works reasonably well if you are trying to clock
 back-to-back activities. Post back after you read that perhaps? Maybe
 you'll find something helpful.
 

org-clock-in takes an optional start-time argument which is used instead
of the current time when non-nil. So I tried

(setq ct (current-time))
(setq start-time (cons (car ct) (list (- (cadr ct) 900) (caddr ct

and started a clock on a task with

ESC ESC : (org-clock-in nil start-time)

and it got clocked in 15 minutes before the current time.

Now I don't propose this as a good UI :-), but it would require just a
small wrapper for it to dtrt.

HTH,
Nick





Re: [O] Prompt for time when clocking in?

2011-10-19 Thread Bernt Hansen
Nathan Neff nathan.n...@gmail.com writes:

 Is there a way to pull up a date/time prompt when clocking in to a task?

 Sometimes, I started a task 15 minutes ago, and have to go through the 
 following
 steps:

 1) clock in on the task,
 2) Go to the CLOCK section for that header and press tab to open it
 3) Fix the clock-in time

 If it's not built in, does anyone have any slick functions that would 
 accomplish
 the same thing? :-)

 Thanks,
 --Nate

For editing clock times I use the agenda

C-c a a v c

and then visit the lines I want to edit from the agenda with RET.

HTH,
Bernt