emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How do I insert just a time stamp in a capture template?
@ 2010-12-08 22:08 Charles Cave
  2010-12-09 20:32 ` Juan Pechiar
  2010-12-09 22:14 ` Charles Cave
  0 siblings, 2 replies; 3+ messages in thread
From: Charles Cave @ 2010-12-08 22:08 UTC (permalink / raw)
  To: emacs-orgmode

I use capture to log how I am spending my time. Every time I start a new task, 
drink a cup of coffee, have a break, arrive at work, go home, I want to quickly 
capture a note.

I use the following template

("l" "Log Time" 
    entry (file+datetree "c:/charles/My Dropbox/GTD/timelog.org") 
    "** %U - %^{Activity}  :TIME:")
)

A typical entry from this template looks like:

* 2010
** 2010-12-December
*** 2010-12-09 Thursday
**** [2010-12-09 Thu 08:10] - Arrived at the office           :TIME:

I would like to just have the time in the headline not the complete date time
stamp.

I couldn't find a % extension in the documenation
(9.1.3.2 Template expansion)

How can I just include a time only in the heading?

Charles

P.S.  My capture-mode tutorial project should be released this weeekend

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

* Re: How do I insert just a time stamp in a capture template?
  2010-12-08 22:08 How do I insert just a time stamp in a capture template? Charles Cave
@ 2010-12-09 20:32 ` Juan Pechiar
  2010-12-09 22:14 ` Charles Cave
  1 sibling, 0 replies; 3+ messages in thread
From: Juan Pechiar @ 2010-12-09 20:32 UTC (permalink / raw)
  To: Charles Cave; +Cc: emacs-orgmode

%(sexp) allows to include lisp expressions in a capture template.

%(format-time-string "%H:%M") should insert the current time.

Regards,
.j.

On Wed, Dec 08, 2010 at 10:08:32PM +0000, Charles Cave wrote:
> I use the following template
>
> ("l" "Log Time"
>     entry (file+datetree "c:/charles/My Dropbox/GTD/timelog.org")
>     "** %U - %^{Activity}  :TIME:")
> )
>
> A typical entry from this template looks like:
>
> * 2010
> ** 2010-12-December
> *** 2010-12-09 Thursday
> **** [2010-12-09 Thu 08:10] - Arrived at the office           :TIME:
>
> I would like to just have the time in the headline not the complete date time
> stamp.
>
> I couldn't find a % extension in the documenation
> (9.1.3.2 Template expansion)

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

* Re: How do I insert just a time stamp in a capture template?
  2010-12-08 22:08 How do I insert just a time stamp in a capture template? Charles Cave
  2010-12-09 20:32 ` Juan Pechiar
@ 2010-12-09 22:14 ` Charles Cave
  1 sibling, 0 replies; 3+ messages in thread
From: Charles Cave @ 2010-12-09 22:14 UTC (permalink / raw)
  To: emacs-orgmode

Charles Cave <charles.cave <at> gmail.com> writes:


> ("l" "Log Time" 
>     entry (file+datetree "c:/charles/My Dropbox/GTD/timelog.org") 
>     "** %U - %^{Activity}  :TIME:")

> How can I just include a time only in the heading?

Thank you Juan for responding to my question:

   %(sexp) allows to include lisp expressions in a capture template.

   %(format-time-string "%H:%M") should insert the current time.

My template now looks like

("l" "Log Time" entry (file+datetree "c:/charles/My Dropbox/GTD/timelog.org")
"** %(format-time-string \"%H:%M\") - %^{Activity}  :TIME:")

Note the escaped quotation marks near %H:%M because this function is inside 
another string.

Here are today's entries from the timelog.org file

*** 2010-12-10 Friday
**** 08:45 - Arrived - coffee and email                               :TIME:
**** 09:00 - Updated sexp in .emacs                                   :TIME:
**** 09:13 - Responded to org-mode postings                           :TIME:

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

end of thread, other threads:[~2010-12-09 22:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-08 22:08 How do I insert just a time stamp in a capture template? Charles Cave
2010-12-09 20:32 ` Juan Pechiar
2010-12-09 22:14 ` Charles Cave

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