emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* taking note when clocking out
@ 2011-04-14  6:56 Radosław Grzanka
  2011-04-14  8:25 ` Giovanni Ridolfi
  0 siblings, 1 reply; 12+ messages in thread
From: Radosław Grzanka @ 2011-04-14  6:56 UTC (permalink / raw)
  To: Org-mode ml

Hello,
   I cannot find this using google nor browsing documentation so I ask 
for help. Generally I don't want to take notes when I'm clocking out 
except for one task.
Is there property I can set that forces me to take note everytime I 
clock out from this single task?

Thanks,
   Radek.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14  6:56 taking note when clocking out Radosław Grzanka
@ 2011-04-14  8:25 ` Giovanni Ridolfi
  2011-04-14  8:34   ` Richard Riley
  2011-04-14 10:17   ` Richard Riley
  0 siblings, 2 replies; 12+ messages in thread
From: Giovanni Ridolfi @ 2011-04-14  8:25 UTC (permalink / raw)
  To: radoslawg; +Cc: Org-mode ml

Radosław Grzanka <radoslawg@gmail.com> writes:

> Hello,
>   I cannot find this using google nor browsing documentation so I ask
> for help. Generally I don't want to take notes when I'm clocking out
> except for one task.
You can use the org-clock-out-hook,

but if you'll post an example, well'have something real to work on:

'But I must have something to work on. I cannot burn snow'
Gandalf

Giovanni ;-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14  8:25 ` Giovanni Ridolfi
@ 2011-04-14  8:34   ` Richard Riley
  2011-04-14  9:02     ` Radosław Grzanka
  2011-04-14 10:17   ` Richard Riley
  1 sibling, 1 reply; 12+ messages in thread
From: Richard Riley @ 2011-04-14  8:34 UTC (permalink / raw)
  To: emacs-orgmode

Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:

> Radosław Grzanka <radoslawg@gmail.com> writes:
>
>> Hello,
>>   I cannot find this using google nor browsing documentation so I ask
>> for help. Generally I don't want to take notes when I'm clocking out
>> except for one task.
> You can use the org-clock-out-hook,
>
> but if you'll post an example, well'have something real to work on:
>
> 'But I must have something to work on. I cannot burn snow'
> Gandalf
>
> Giovanni ;-)
>

From reading the OP he is requesting a way to mark/tag a task so that
when he clocks out he is prompted to take a note.

In this case someone more org savvy might construct something which, in
the clock out hook, sees if, e.g, the "note-at-clockout" property is set
and if so prompts the user for a new note which is then duly attached to
that org item.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14  8:34   ` Richard Riley
@ 2011-04-14  9:02     ` Radosław Grzanka
  0 siblings, 0 replies; 12+ messages in thread
From: Radosław Grzanka @ 2011-04-14  9:02 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

W dniu 2011-04-14 10:34, Richard Riley pisze:
> Giovanni Ridolfi<giovanni.ridolfi@yahoo.it>  writes:
>
>> Radosław Grzanka<radoslawg@gmail.com>  writes:
>>
>>> Hello,
>>>    I cannot find this using google nor browsing documentation so I ask
>>> for help. Generally I don't want to take notes when I'm clocking out
>>> except for one task.
>> You can use the org-clock-out-hook,
>>
>> but if you'll post an example, well'have something real to work on:
>>
>> 'But I must have something to work on. I cannot burn snow'
>> Gandalf
>>
>> Giovanni ;-)
>>
>
>  From reading the OP he is requesting a way to mark/tag a task so that
> when he clocks out he is prompted to take a note.
>
> In this case someone more org savvy might construct something which, in
> the clock out hook, sees if, e.g, the "note-at-clockout" property is set
> and if so prompts the user for a new note which is then duly attached to
> that org item.


Exactly that.

I'm not sure what example I can provide. I'd like to have org file like:

------------------------
#+STARTUP: nolognoteclock-out

* Headline1

* Headline 2
:PROPERTIES:
:CLOCK-OUT-NOTE: t
:END:

* Headline 3

-------------------------

When clocking out from "Headline 2" I'd like to be forced to give a 
note. Real life example is that I do not really care about what I have 
been doing during my clocked-in time except for some discussions with 
client, who is bugging me constantly and I record it under "Headline 2".

I don't mind hooking in and using "unique id" of this task but I'm not 
lisp fluent to do that myslef.

Thanks,
   Radek.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14  8:25 ` Giovanni Ridolfi
  2011-04-14  8:34   ` Richard Riley
@ 2011-04-14 10:17   ` Richard Riley
  2011-04-14 11:14     ` Radosław Grzanka
  2011-04-14 12:21     ` Giovanni Ridolfi
  1 sibling, 2 replies; 12+ messages in thread
From: Richard Riley @ 2011-04-14 10:17 UTC (permalink / raw)
  To: emacs-orgmode

Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:

> Radosław Grzanka <radoslawg@gmail.com> writes:
>
>> Hello,
>>   I cannot find this using google nor browsing documentation so I ask
>> for help. Generally I don't want to take notes when I'm clocking out
>> except for one task.
> You can use the org-clock-out-hook,
>
> but if you'll post an example, well'have something real to work on:
>
> 'But I must have something to work on. I cannot burn snow'
> Gandalf
>
> Giovanni ;-)
>

I thought I'd have a quick crack at this since its ages I tried any
elisp

Something along the lines of


,----
|     (require 'org-clock)
| 
|     (defun rgr/check-for-clock-out-note()
|           (interactive)
|           (save-excursion
|             (set-mark (goto-char (org-entry-beginning-position)))
|             (let ((tags (org-get-tags)))
|               (message "tags: %s " tags)
|               (if (member "clockout_note" tags)
|                   (org-add-note)))))
| 
|     (add-hook 'org-clock-out-hook 'rgr/check-for-clock-out-note)
`----

it uses a tag ("clockout_note") so can benefit from inherit etc. I'm
sure its not optimal or well written but a quick test and it worked.

btw, when entering a tag "-" is illegal?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14 10:17   ` Richard Riley
@ 2011-04-14 11:14     ` Radosław Grzanka
  2011-04-14 12:21     ` Giovanni Ridolfi
  1 sibling, 0 replies; 12+ messages in thread
From: Radosław Grzanka @ 2011-04-14 11:14 UTC (permalink / raw)
  To: emacs-orgmode

Hello,
> I thought I'd have a quick crack at this since its ages I tried any
> elisp
>
> Something along the lines of
>
>
> ,----
> |     (require 'org-clock)
> |
> |     (defun rgr/check-for-clock-out-note()
> |           (interactive)
> |           (save-excursion
> |             (set-mark (goto-char (org-entry-beginning-position)))
> |             (let ((tags (org-get-tags)))
> |               (message "tags: %s " tags)
> |               (if (member "clockout_note" tags)
> |                   (org-add-note)))))
> |
> |     (add-hook 'org-clock-out-hook 'rgr/check-for-clock-out-note)
> `----

Mircale! Thank you.

Radek.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14 10:17   ` Richard Riley
  2011-04-14 11:14     ` Radosław Grzanka
@ 2011-04-14 12:21     ` Giovanni Ridolfi
  2011-04-14 12:40       ` Richard Riley
  1 sibling, 1 reply; 12+ messages in thread
From: Giovanni Ridolfi @ 2011-04-14 12:21 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode

Richard Riley <rileyrg@googlemail.com> writes:

Hi, Richard, 
nice solution.
>
> btw, when entering a tag "-" is illegal?

yes, underscore should be used.

1. from the manual:
      Tags are normal words containing letters, numbers, `_',
      and `@'.

2. from the source ;-)
   org-set-tags in org.el
    tags (org-re "[^[:alnum:]_@#%]+"))
(line 12959)

and few lines (12950) up  + or - are used in the search, see 
section "Match syntax" under "Matching tags and properties"
in the manual.

Hope that explains.

Giovanni

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14 12:21     ` Giovanni Ridolfi
@ 2011-04-14 12:40       ` Richard Riley
  2011-04-14 12:58         ` Giovanni Ridolfi
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Riley @ 2011-04-14 12:40 UTC (permalink / raw)
  To: emacs-orgmode

Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:

> Richard Riley <rileyrg@googlemail.com> writes:
>
> Hi, Richard, 
> nice solution.
>>
>> btw, when entering a tag "-" is illegal?
>
> yes, underscore should be used.
>
> 1. from the manual:
>       Tags are normal words containing letters, numbers, `_',
>       and `@'.
>
> 2. from the source ;-)
>    org-set-tags in org.el
>     tags (org-re "[^[:alnum:]_@#%]+"))
> (line 12959)
>
> and few lines (12950) up  + or - are used in the search, see 
> section "Match syntax" under "Matching tags and properties"
> in the manual.
>
> Hope that explains.
>

yeah, I completely had a brain fart over that one. I did actually know
that but .. forgot ... ;)

ps I have signed fsf papers if that little utility snippet is any good
(ok, will need a defvar I guess for the tag used).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14 12:40       ` Richard Riley
@ 2011-04-14 12:58         ` Giovanni Ridolfi
  2011-04-14 14:20           ` Matt Lundin
  0 siblings, 1 reply; 12+ messages in thread
From: Giovanni Ridolfi @ 2011-04-14 12:58 UTC (permalink / raw)
  To: Richard Riley; +Cc: Matt Lundin, emacs-orgmode

Richard Riley <rileyrg@googlemail.com> writes:

Cc:-ed Matt Lundin 
>
> ps I have signed fsf papers if that little utility snippet is any good
> (ok, will need a defvar I guess for the tag used).

Maybe in the hack page of worg?
Feel free to reword my English ;-)

Giovanni
------------------ org-hacks.org  ------------

** Using and Managing Org-Metadata
[...] <skip>

*** A way to tag a task so that when clocking-out user is prompted to take a note.
-- Richard G. Riley

A small function that, finding the tag "clockout_note" in a headline,
prompts for a note. It uses the tag ("clockout_note") so can benefit 
from inherit etc...

#+begin_src emacs-lisp
     (defun rgr/check-for-clock-out-note()
           (interactive)
           (save-excursion
             (set-mark (goto-char (org-entry-beginning-position)))
             (let ((tags (org-get-tags)))
               (message "tags: %s " tags)
               (if (member "clockout_note" tags)
                   (org-add-note)))))
 
     (add-hook 'org-clock-out-hook 'rgr/check-for-clock-out-note)
#+end_src

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14 12:58         ` Giovanni Ridolfi
@ 2011-04-14 14:20           ` Matt Lundin
  2011-04-14 14:42             ` Richard Riley
  0 siblings, 1 reply; 12+ messages in thread
From: Matt Lundin @ 2011-04-14 14:20 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: Richard Riley, emacs-orgmode

Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:

> Richard Riley <rileyrg@googlemail.com> writes:
>
> Cc:-ed Matt Lundin 
>>
>> ps I have signed fsf papers if that little utility snippet is any good
>> (ok, will need a defvar I guess for the tag used).
>
> Maybe in the hack page of worg?
> Feel free to reword my English ;-)

Thanks! I put it in org-hacks on Worg.

Best,
Matt

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14 14:20           ` Matt Lundin
@ 2011-04-14 14:42             ` Richard Riley
  2011-04-14 16:48               ` Matt Lundin
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Riley @ 2011-04-14 14:42 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode

Matt Lundin <mdl@imapmail.org> writes:

> Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:
>
>> Richard Riley <rileyrg@googlemail.com> writes:
>>
>> Cc:-ed Matt Lundin 
>>>
>>> ps I have signed fsf papers if that little utility snippet is any good
>>> (ok, will need a defvar I guess for the tag used).
>>
>> Maybe in the hack page of worg?
>> Feel free to reword my English ;-)
>
> Thanks! I put it in org-hacks on Worg.
>
> Best,
> Matt

I think someone needs to rework the set-mark bit. I see from the
docstring it shouldnt be used. I cribbed that bit from some code I wrote
for org-googlecl ages ago which in itself was a "learn by doing" hack.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: taking note when clocking out
  2011-04-14 14:42             ` Richard Riley
@ 2011-04-14 16:48               ` Matt Lundin
  0 siblings, 0 replies; 12+ messages in thread
From: Matt Lundin @ 2011-04-14 16:48 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode

Richard Riley <rileyrg@googlemail.com> writes:

> Matt Lundin <mdl@imapmail.org> writes:
>
>> Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:
>>
>>> Richard Riley <rileyrg@googlemail.com> writes:
>>>
>>> Cc:-ed Matt Lundin 
>>>>
>>>> ps I have signed fsf papers if that little utility snippet is any good
>>>> (ok, will need a defvar I guess for the tag used).
>>>
>>> Maybe in the hack page of worg?
>>> Feel free to reword my English ;-)
>>
>> Thanks! I put it in org-hacks on Worg.
>>
>> Best,
>> Matt
>
> I think someone needs to rework the set-mark bit. 

Done.

> I see from the docstring it shouldnt be used. 

Right. I also allowed the function to fail gracefully when there are no
tags present.

Thanks,
Matt

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-04-14 16:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-14  6:56 taking note when clocking out Radosław Grzanka
2011-04-14  8:25 ` Giovanni Ridolfi
2011-04-14  8:34   ` Richard Riley
2011-04-14  9:02     ` Radosław Grzanka
2011-04-14 10:17   ` Richard Riley
2011-04-14 11:14     ` Radosław Grzanka
2011-04-14 12:21     ` Giovanni Ridolfi
2011-04-14 12:40       ` Richard Riley
2011-04-14 12:58         ` Giovanni Ridolfi
2011-04-14 14:20           ` Matt Lundin
2011-04-14 14:42             ` Richard Riley
2011-04-14 16:48               ` Matt Lundin

Code repositories for project(s) associated with this 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).