Re: [O] help advicing org-todo

2013-01-06 Thread Luca Ferrari
This is great!

Thanks,
Luca


 (setq org-clock-in-switch-to-state STRT)
 (setq org-clock-out-switch-to-state DONE)




Re: [O] help advicing org-todo

2013-01-04 Thread Bastien
Hi Luca,

Luca Ferrari fluca1...@infinito.it writes:

 a very good advice. Now, forgive my lisp ignorance, but I've defined
 the following function to do what I want:

...

Actually you can simply use

(setq org-clock-in-switch-to-state STRT)
(setq org-clock-out-switch-to-state DONE)

HTH,

-- 
 Bastien



Re: [O] help advicing org-todo

2013-01-03 Thread Bastien
Hi Luca,

Luca Ferrari fluca1...@infinito.it writes:

 I'd like to advice the function org-todo to check in and check out the
 clock automatically.

I would not advice `org-todo', I would explore the idea of adding a
function to `org-after-todo-state-change-hook'.

 I've defined the org-todo-keywords so that they have a choice letter as 
 follows:

 (setq org-todo-keywords
   '( (sequence TODO(t!) | DONE(d!))
  (sequence FEATURE(f!) BUG(b!)  IMPLEMENTING(i!) |
 COMPLETED(c!))
  ))

 and I'd like to start the clock each time the i (implementing) is
 chosen, stopping the clock each time the c (completed) is selected.

You can use (setq org-clock-out-when-done t) for this.

 However I've a little problem doing the advice because the argument is
 null and therefore I don't know which letter the user has pressed.
 Anyone can provide a little help?

HTH,

-- 
 Bastien



Re: [O] help advicing org-todo

2013-01-03 Thread Luca Ferrari
Thanks,
a very good advice. Now, forgive my lisp ignorance, but I've defined
the following function to do what I want:

(defun org-todo-automatic-clock ()
  Starts/Stops the clock when a task is marked as implementing or completed
  (if (string= state org-todo-fluca1978-running)
  (org-clock-in)
(if (or (string= state last-state) (string= state
org-todo-fluca1978-suspended))
(org-clock-out)
  )
)
  ) ;end of defun


the problem is how to tell the org-todo-keyword to use variables
instead of strings, since the following is not working:

(setq org-todo-fluca1978-running   IMPLEMENTING(i!) )
(setq org-todo-fluca1978-suspended SUSPENDED(s!) )

(setq org-todo-keywords
  '(
 (sequence FEATURE(f!) BUG(b!)
'org-todo-fluca1978-running 'org-todo-fluca1978-suspended |
COMPLETED(c!))
 ))

What am I missing here?

Thanks,
Luca



Re: [O] help advicing org-todo

2013-01-03 Thread Nick Dokos
Luca Ferrari fluca1...@infinito.it wrote:

 Thanks,
 a very good advice. Now, forgive my lisp ignorance, but I've defined
 the following function to do what I want:
 
 (defun org-todo-automatic-clock ()
   Starts/Stops the clock when a task is marked as implementing or completed
   (if (string= state org-todo-fluca1978-running)
   (org-clock-in)
 (if (or (string= state last-state) (string= state
 org-todo-fluca1978-suspended))
 (org-clock-out)
   )
 )
   ) ;end of defun
 
 
 the problem is how to tell the org-todo-keyword to use variables
 instead of strings, since the following is not working:
 
 (setq org-todo-fluca1978-running   IMPLEMENTING(i!) )
 (setq org-todo-fluca1978-suspended SUSPENDED(s!) )
 
 (setq org-todo-keywords
   '(
  (sequence FEATURE(f!) BUG(b!)
 'org-todo-fluca1978-running 'org-todo-fluca1978-suspended |
 COMPLETED(c!))
  ))
 
 What am I missing here?
 

OTTOMH: Should state be org-state instead?

Nick