* clock based context settings
@ 2010-01-19 22:16 Richard Riley
2010-01-20 8:30 ` David Maus
0 siblings, 1 reply; 4+ messages in thread
From: Richard Riley @ 2010-01-19 22:16 UTC (permalink / raw
To: Emacs-orgmode mailing list
I would like to be able to execute arbitrary elisp when I clock in or
out of a certain org.item This would be very, very useful for defining
variables or even keystrokes on a "per project" basis. Ideally it would
work using inheritance so if an item does not have something then the
project or file level values would be used.
e.g at the file level:
#+CLOCKINEXEC: (setq curr-url "project1.com")
Or at the org item level
** touch up picture of the org logo
:PROPERTIES:
:CLOCKINEXEC: (setq curr-url "org-mode.com/images")
:END:
Would others think this might be useful or is there another way/approach
to achieve something similar?
My example might for instance having a key bound to launching a url and
the url will set depending n´on which web project I am working on.
--
Google Talk : rileyrgdev@googlemail.com http://www.google.com/talk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: clock based context settings
2010-01-19 22:16 clock based context settings Richard Riley
@ 2010-01-20 8:30 ` David Maus
2010-01-20 9:34 ` Richard Riley
0 siblings, 1 reply; 4+ messages in thread
From: David Maus @ 2010-01-20 8:30 UTC (permalink / raw
To: Richard Riley; +Cc: Emacs-orgmode mailing list
[-- Attachment #1.1: Type: text/plain, Size: 1255 bytes --]
Hi Richard,
At Tue, 19 Jan 2010 23:16:08 +0100,
Richard Riley wrote:
>
>
> I would like to be able to execute arbitrary elisp when I clock in or
> out of a certain org.item This would be very, very useful for defining
> variables or even keystrokes on a "per project" basis. Ideally it would
> work using inheritance so if an item does not have something then the
> project or file level values would be used.
>
> e.g at the file level:
>
> #+CLOCKINEXEC: (setq curr-url "project1.com")
>
> Or at the org item level
>
> ** touch up picture of the org logo
> :PROPERTIES:
> :CLOCKINEXEC: (setq curr-url "org-mode.com/images")
> :END:
>
> Would others think this might be useful or is there another way/approach
> to achieve something similar?
You could use the org-clock-hooks `org-clock-in-hook',
`org-clock-out-hook' and `org-clock-cancel-hook' in combination with a
function that checks for the desired conditions and sets the variables
accordingly.
A question that came in my mind: What happens if you clock out or
cancel a clock? Are the variables kept or set to a default value? Or
to the value they had before clocking in?
Regards
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com
[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: clock based context settings
2010-01-20 8:30 ` David Maus
@ 2010-01-20 9:34 ` Richard Riley
2010-01-28 17:42 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Richard Riley @ 2010-01-20 9:34 UTC (permalink / raw
To: emacs-orgmode
David Maus <maus.david@gmail.com> writes:
> --===============0364025519==
> Content-Type: multipart/signed;
> boundary="pgp-sign-Multipart_Wed_Jan_20_09:30:37_2010-1";
> protocol="application/pgp-signature"
> Content-Transfer-Encoding: 7bit
>
> --pgp-sign-Multipart_Wed_Jan_20_09:30:37_2010-1
> Content-Type: text/plain; charset=US-ASCII
>
> Hi Richard,
>
> At Tue, 19 Jan 2010 23:16:08 +0100,
> Richard Riley wrote:
>>
>>
>> I would like to be able to execute arbitrary elisp when I clock in or
>> out of a certain org.item This would be very, very useful for defining
>> variables or even keystrokes on a "per project" basis. Ideally it would
>> work using inheritance so if an item does not have something then the
>> project or file level values would be used.
>>
>> e.g at the file level:
>>
>> #+CLOCKINEXEC: (setq curr-url "project1.com")
>>
>> Or at the org item level
>>
>> ** touch up picture of the org logo
>> :PROPERTIES:
>> :CLOCKINEXEC: (setq curr-url "org-mode.com/images")
>> :END:
>>
>> Would others think this might be useful or is there another way/approach
>> to achieve something similar?
>
> You could use the org-clock-hooks `org-clock-in-hook',
> `org-clock-out-hook' and `org-clock-cancel-hook' in combination with a
> function that checks for the desired conditions and sets the variables
> accordingly.
No variables or conditions. Just exec the block.
>
> A question that came in my mind: What happens if you clock out or
> cancel a clock? Are the variables kept or set to a default value? Or
> to the value they had before clocking in?
Neither. I had thought to keep it easy - globals/whatever set by both
clockin and clockout - its up to you to ensure that the elisp in your
in/out code properties "do it right". They are nothing more than single
elisp snippets. Probably a progn sequence or equivalent But then I dont
know too much about things like local/global scope in elisp. ie can I
create some sort of specific "object" and tack these value on and have
them all just vanish when clockout occurs? Even then I could see that
clock in/out code (:CLOCKOUTEXEC:) would probably set things globally
frequently.
Limited experience with elisp and how it all hangs together makes it
hard for me to pinpoint what might be the best approach.
e.g globals set (if you so want) or can we provide something with more
localisation on a per task basis to complement/simplify the code? ie
perhaps CLOCKINEXEC is "(progn (org-with-current-task-set-var "url"
"ibm.com")(setq myGlobal nil)) and elsewhere a hot key invokes
(browse-url (org-with-current-task-get "url")). I dont know to be honest
what the "elisp/emacs" paradigm/approach is to things like that.
Just chewing the cud at this stage;)
--
Google Talk : rileyrgdev@googlemail.com http://www.google.com/talk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: clock based context settings
2010-01-20 9:34 ` Richard Riley
@ 2010-01-28 17:42 ` Carsten Dominik
0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2010-01-28 17:42 UTC (permalink / raw
To: Richard Riley; +Cc: emacs-orgmode
Hi Richard,
I do not see a general-enough use case for this. You can, of course,
as mentioned by David) use the existing hooks for something like
this. Here is an example (untested)
(add-hook 'org-clock-in-hook
(lambda ()
(let ((code (org-entry-get nil "CLOCKINEXEC")))
(when (and code (string-match "\\S-" code))
(eval (read code))))))
HTH
- Carsten
On Jan 20, 2010, at 10:34 AM, Richard Riley wrote:
> David Maus <maus.david@gmail.com> writes:
>
>> --===============0364025519==
>> Content-Type: multipart/signed;
>> boundary="pgp-sign-Multipart_Wed_Jan_20_09:30:37_2010-1";
>> protocol="application/pgp-signature"
>> Content-Transfer-Encoding: 7bit
>>
>> --pgp-sign-Multipart_Wed_Jan_20_09:30:37_2010-1
>> Content-Type: text/plain; charset=US-ASCII
>>
>> Hi Richard,
>>
>> At Tue, 19 Jan 2010 23:16:08 +0100,
>> Richard Riley wrote:
>>>
>>>
>>> I would like to be able to execute arbitrary elisp when I clock in
>>> or
>>> out of a certain org.item This would be very, very useful for
>>> defining
>>> variables or even keystrokes on a "per project" basis. Ideally it
>>> would
>>> work using inheritance so if an item does not have something then
>>> the
>>> project or file level values would be used.
>>>
>>> e.g at the file level:
>>>
>>> #+CLOCKINEXEC: (setq curr-url "project1.com")
>>>
>>> Or at the org item level
>>>
>>> ** touch up picture of the org logo
>>> :PROPERTIES:
>>> :CLOCKINEXEC: (setq curr-url "org-mode.com/images")
>>> :END:
>>>
>>> Would others think this might be useful or is there another way/
>>> approach
>>> to achieve something similar?
>>
>> You could use the org-clock-hooks `org-clock-in-hook',
>> `org-clock-out-hook' and `org-clock-cancel-hook' in combination
>> with a
>> function that checks for the desired conditions and sets the
>> variables
>> accordingly.
>
> No variables or conditions. Just exec the block.
>
>>
>> A question that came in my mind: What happens if you clock out or
>> cancel a clock? Are the variables kept or set to a default value? Or
>> to the value they had before clocking in?
>
> Neither. I had thought to keep it easy - globals/whatever set by both
> clockin and clockout - its up to you to ensure that the elisp in your
> in/out code properties "do it right". They are nothing more than
> single
> elisp snippets. Probably a progn sequence or equivalent But then I
> dont
> know too much about things like local/global scope in elisp. ie can I
> create some sort of specific "object" and tack these value on and have
> them all just vanish when clockout occurs? Even then I could see that
> clock in/out code (:CLOCKOUTEXEC:) would probably set things globally
> frequently.
>
> Limited experience with elisp and how it all hangs together makes it
> hard for me to pinpoint what might be the best approach.
>
> e.g globals set (if you so want) or can we provide something with more
> localisation on a per task basis to complement/simplify the code? ie
> perhaps CLOCKINEXEC is "(progn (org-with-current-task-set-var "url"
> "ibm.com")(setq myGlobal nil)) and elsewhere a hot key invokes
> (browse-url (org-with-current-task-get "url")). I dont know to be
> honest
> what the "elisp/emacs" paradigm/approach is to things like that.
>
> Just chewing the cud at this stage;)
>
> --
> Google Talk : rileyrgdev@googlemail.com http://www.google.com/talk
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-01-28 23:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-19 22:16 clock based context settings Richard Riley
2010-01-20 8:30 ` David Maus
2010-01-20 9:34 ` Richard Riley
2010-01-28 17:42 ` Carsten Dominik
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.