* How to know in elisp if I am in the agenda ..
@ 2013-04-11 12:13 Rainer Stengele
2013-04-11 12:31 ` Thorsten Jolitz
0 siblings, 1 reply; 4+ messages in thread
From: Rainer Stengele @ 2013-04-11 12:13 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to know in elisp if I am in the agenda ..
2013-04-11 12:13 How to know in elisp if I am in the agenda Rainer Stengele
@ 2013-04-11 12:31 ` Thorsten Jolitz
2013-04-11 12:42 ` Tassilo Horn
0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Jolitz @ 2013-04-11 12:31 UTC (permalink / raw)
To: emacs-orgmode
Rainer Stengele <rainer.stengele@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to know in elisp if I am in the agenda ..
2013-04-11 12:31 ` Thorsten Jolitz
@ 2013-04-11 12:42 ` Tassilo Horn
2013-04-11 13:58 ` Rainer Stengele
0 siblings, 1 reply; 4+ messages in thread
From: Tassilo Horn @ 2013-04-11 12:42 UTC (permalink / raw)
To: emacs-orgmode
Thorsten Jolitz <tjolitz@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to know in elisp if I am in the agenda ..
2013-04-11 12:42 ` Tassilo Horn
@ 2013-04-11 13:58 ` Rainer Stengele
0 siblings, 0 replies; 4+ messages in thread
From: Rainer Stengele @ 2013-04-11 13:58 UTC (permalink / raw)
Cc: emacs-orgmode
Am 11.04.2013 14:42, schrieb Tassilo Horn:
> Thorsten Jolitz <tjolitz@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
>
>
>
Tassilo,
that works perfect and my function also does now!
Exciting!
Thanks, Rainer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-11 14:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11 12:13 How to know in elisp if I am in the agenda Rainer Stengele
2013-04-11 12:31 ` Thorsten Jolitz
2013-04-11 12:42 ` Tassilo Horn
2013-04-11 13:58 ` Rainer Stengele
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).