emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Easily adding notes to a TODO item
@ 2011-04-26 16:14 Shawn Willden
  2011-04-26 16:40 ` Matt Lundin
  2011-04-26 16:41 ` Matt Lundin
  0 siblings, 2 replies; 6+ messages in thread
From: Shawn Willden @ 2011-04-26 16:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi everyone,

I use an org file to track my work.  It contains top-level headers
corresponding to projects with sub-headers corresponding to
sub-projects and/or tasks.  I clock in and out on individual TODOs to
track time -- all pretty normal, I think.
I'd also like to be able to easily take notes using something like
"remember", but with the notes by default automatically appended to
the text under the task I'm currently clocked into, with an attached
timestamp.  Right now I'm manually positioning my cursor in the right
place, then using "C-u C-c . <RET>" to create a timestamp.  This
works, but it's cumbersome enough that I don't take as many notes as I
should.

So, I'd really like to be able to hit "C-c C-r" (or something) from
anywhere in EMACS, type my note, and have it automatically go the
right place, with a timestamp.  What would make it really awesome is
if I could also have a shortcut that would place the name of the file
I was editing when I hit "C-c C-r" in the note.

Any suggestions?

Thanks,

--
Shawn.

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

* Re: Easily adding notes to a TODO item
  2011-04-26 16:14 Easily adding notes to a TODO item Shawn Willden
@ 2011-04-26 16:40 ` Matt Lundin
       [not found]   ` <BANLkTinhCQn8MV0qRqiLftK+BUb94US57g@mail.gmail.com>
  2011-04-26 16:41 ` Matt Lundin
  1 sibling, 1 reply; 6+ messages in thread
From: Matt Lundin @ 2011-04-26 16:40 UTC (permalink / raw)
  To: Shawn Willden; +Cc: emacs-orgmode

Shawn Willden <swillden@google.com> writes:

> Hi everyone,
>
> I use an org file to track my work.  It contains top-level headers
> corresponding to projects with sub-headers corresponding to
> sub-projects and/or tasks.  I clock in and out on individual TODOs to
> track time -- all pretty normal, I think.
> I'd also like to be able to easily take notes using something like
> "remember", but with the notes by default automatically appended to
> the text under the task I'm currently clocked into, with an attached
> timestamp.  Right now I'm manually positioning my cursor in the right
> place, then using "C-u C-c . <RET>" to create a timestamp.  This
> works, but it's cumbersome enough that I don't take as many notes as I
> should.
>
> So, I'd really like to be able to hit "C-c C-r" (or something) from
> anywhere in EMACS, type my note, and have it automatically go the
> right place, with a timestamp.  What would make it really awesome is
> if I could also have a shortcut that would place the name of the file
> I was editing when I hit "C-c C-r" in the note.
>

You can do this with org-capture by typing C-2 C-c C-w within the
capture buffer. That will refile the new note to the currently clocked
task.

You can also use a capture template for this, e.g.:

	("c" "Clock sibling" entry
	 (clock)
	 "* %^{Title}\n %U\n %a\n\n %i")

Type C-h v org-capture-templates for more details.

Another option: you can quickly navigate to the current clocked task
with org-clock-goto (C-c C-x C-j). Then you can type C-c C-z to add a
time-stamped note.

Best,
Matt

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

* Re: Easily adding notes to a TODO item
  2011-04-26 16:14 Easily adding notes to a TODO item Shawn Willden
  2011-04-26 16:40 ` Matt Lundin
@ 2011-04-26 16:41 ` Matt Lundin
  1 sibling, 0 replies; 6+ messages in thread
From: Matt Lundin @ 2011-04-26 16:41 UTC (permalink / raw)
  To: Shawn Willden; +Cc: emacs-orgmode

Shawn Willden <swillden@google.com> writes:

> So, I'd really like to be able to hit "C-c C-r" (or something) from
> anywhere in EMACS, type my note, and have it automatically go the
> right place, with a timestamp.  What would make it really awesome is
> if I could also have a shortcut that would place the name of the file
> I was editing when I hit "C-c C-r" in the note.

This exists:

(info "(org) Capture")

Best,
Matt

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

* Re: Easily adding notes to a TODO item
       [not found]   ` <BANLkTinhCQn8MV0qRqiLftK+BUb94US57g@mail.gmail.com>
@ 2011-04-27 12:42     ` Matt Lundin
  2011-04-27 13:49       ` Shawn Willden
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Lundin @ 2011-04-27 12:42 UTC (permalink / raw)
  To: Shawn Willden; +Cc: Org Mode

Shawn Willden <swillden@google.com> writes:

> On Tue, Apr 26, 2011 at 10:40 AM, Matt Lundin <mdl@imapmail.org> wrote:
>> Shawn Willden <swillden@google.com> writes:
>>> I'd also like to be able to easily take notes using something like
>>> "remember", but with the notes by default automatically appended to
>>> the text under the task I'm currently clocked into, with an attached
>>> timestamp.
>
>> You can also use a capture template for this, e.g.:
>
> I had to update org-mode to get a working org-capture, and it looks
> like I can't get plain text automatically placed in the correct spot
> (though list entries work fine, which is acceptable), and I've created
> a custom function to take the current file path and linkify it nicely,
> with some variation depending on the contents of the path.
>
> ... but that last bit isn't working.
>
> I have a function "linkify-path" which takes a path as a parameter and
> properly converts the path into an org-mode link in the way I want.
> But the function doesn't work correctly when I call it from my
> template.
>
> My template looks like:
>
>   ("c" "Clock sibling" item (clock) "%T %(linkify-path \"%F\")")
>
> It almost works.  The first think linkify-path does is call
> string-match to look for a particular substring that I want to handle
> specially.  When I call linkify-path normally, this works.  When it's
> invoked by the expansion of the template, the match appears always to
> fail, so I never get the special handling.
>

I'm not too familiar with invoking sexp expansion within capture
templates and am not sure whether you can expand an item within a sexp.
I imagine other community members might have some ideas. (I'm Cc'ing the
ML on this reply.)

Would the following work, or do you require something more complex?

("c" "Clock sibling" item (clock) "%T %a")

Best,
Matt

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

* Re: Easily adding notes to a TODO item
  2011-04-27 12:42     ` Matt Lundin
@ 2011-04-27 13:49       ` Shawn Willden
  2011-04-27 17:19         ` Matt Lundin
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn Willden @ 2011-04-27 13:49 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

On Wed, Apr 27, 2011 at 6:42 AM, Matt Lundin <mdl@imapmail.org> wrote:
> I'm not too familiar with invoking sexp expansion within capture
> templates and am not sure whether you can expand an item within a sexp.

It does work, sort of.  My function is of the form:

    if path matches regexp
        return complicated link construction
    else
        return "[[file:" + path + "]]"

What happens is that when called with the expanded %F the matching
always fails so the "else" branch is always taken.  When called from
evaluated lisp code (e.g. (linkify "foo/bar")), the function works
correctly.

> I imagine other community members might have some ideas. (I'm Cc'ing the
> ML on this reply.)

Doh!  Most ML's have the reply-to set to default to the list.  I
didn't check to TO; I'd intended my reply to go to the ML as well.

> Would the following work, or do you require something more complex?
>
> ("c" "Clock sibling" item (clock) "%T %a")

I require something more complex.  Our code repository has a pretty
nifty web interface with a lot of very useful features.  What I'm
trying to do is arrange that if the file that I was working on when I
created the note is from the source repository, I create a link to the
web interface's rendition of the file, rather than to the file on the
file system.  If the file isn't from the code repository then I just
create an ordinary file link.

Thanks,

-- 
Shawn

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

* Re: Easily adding notes to a TODO item
  2011-04-27 13:49       ` Shawn Willden
@ 2011-04-27 17:19         ` Matt Lundin
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Lundin @ 2011-04-27 17:19 UTC (permalink / raw)
  To: Shawn Willden; +Cc: Org Mode

Shawn Willden <swillden@google.com> writes:

> On Wed, Apr 27, 2011 at 6:42 AM, Matt Lundin <mdl@imapmail.org> wrote:
>> I'm not too familiar with invoking sexp expansion within capture
>> templates and am not sure whether you can expand an item within a sexp.
>
> It does work, sort of.  My function is of the form:
>
>     if path matches regexp
>         return complicated link construction
>     else
>         return "[[file:" + path + "]]"
>
> What happens is that when called with the expanded %F the matching
> always fails so the "else" branch is always taken.  When called from
> evaluated lisp code (e.g. (linkify "foo/bar")), the function works
> correctly.
>

[...]

>> Would the following work, or do you require something more complex?
>>
>> ("c" "Clock sibling" item (clock) "%T %a")
>
> I require something more complex.  Our code repository has a pretty
> nifty web interface with a lot of very useful features.  What I'm
> trying to do is arrange that if the file that I was working on when I
> created the note is from the source repository, I create a link to the
> web interface's rendition of the file, rather than to the file on the
> file system.  If the file isn't from the code repository then I just
> create an ordinary file link.

Perhaps a simpler option would be to add a function to
org-store-link-functions. See the docstring of that variable for more
details.

The advantage of this approach is that your function would be called
whenever you are storing a link in one of the relevant files, instead of
only via a particular capture template.

Best,
Matt

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

end of thread, other threads:[~2011-04-27 17:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-26 16:14 Easily adding notes to a TODO item Shawn Willden
2011-04-26 16:40 ` Matt Lundin
     [not found]   ` <BANLkTinhCQn8MV0qRqiLftK+BUb94US57g@mail.gmail.com>
2011-04-27 12:42     ` Matt Lundin
2011-04-27 13:49       ` Shawn Willden
2011-04-27 17:19         ` Matt Lundin
2011-04-26 16:41 ` Matt Lundin

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).