[O] How to know in elisp if I am in the agenda ..

2013-04-11 Thread Rainer Stengele
Hi,

I try to automate clock in and clock out operations.

I have put something like this together:

(defun rst/clock-in-out ()
  (interactive)
  (when org-agenda-info
;; (org-agenda-switch-to))
(org-agenda-goto))
  (show-subtree)
  (org-clock-in)
  (org-clock-out)
  (unless (org-at-heading-p) (outline-previous-heading))
  (search-forward CLOCK: )
  (forward-char 19)
  (org-shiftcontrolup)
  (org-shiftdown))

(define-key org-agenda-mode-map (kbd f10) 'rst/clock-in-out)
(define-key org-mode-map (kbd f10) 'rst/clock-in-out)


Being in any subtree it works flawlessly.
What I now want: Do the same when being on an agenda item and pressing F10.
I want to switch to the org file and start what already works.
What I have does not work, neither (org-agenda-switch-to) nor (org-agenda-goto)

Please help. Where could I find information/docs for something like
How to determine when I am in agenda view?

Thanks,
Rainer




Re: [O] How to know in elisp if I am in the agenda ..

2013-04-11 Thread Thorsten Jolitz
Rainer Stengele rainer.steng...@online.de writes:

 Please help. Where could I find information/docs for something like
 How to determine when I am in agenda view?

,
| M-: (string-equal *Org Agenda* (buffer-name))
`

gives t when called from inside the agenda.

-- 
cheers,
Thorsten




Re: [O] How to know in elisp if I am in the agenda ..

2013-04-11 Thread Tassilo Horn
Thorsten Jolitz tjol...@gmail.com writes:

 Please help. Where could I find information/docs for something like
 How to determine when I am in agenda view?

 ,
 | M-: (string-equal *Org Agenda* (buffer-name))
 `

 gives t when called from inside the agenda.

Better

  (string-equal org-agenda-buffer-name (buffer-name))

or even better

  (eq major-mode 'org-agenda-mode)

Bye,
Tassilo