emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Hendy <jw.hendy@gmail.com>
To: c b <24x7x366@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Alternate format for datetree
Date: Thu, 6 Sep 2012 10:33:33 -0500	[thread overview]
Message-ID: <CA+M2ft9kM8nu5CDATME6G+tXzYdFdGStO6nJwsNDGedWm2VibA@mail.gmail.com> (raw)
In-Reply-To: <CANkEzN94rQP8TEsFQZ6BeCVeSA+2T9RpfjAs_CufjyXnbgfBjQ@mail.gmail.com>

On Thu, Sep 6, 2012 at 12:42 AM, c b <24x7x366@gmail.com> wrote:
> Hi John and Nick,
>
> Thank a lot for your suggestions. I finally got it working. It took a while
> to figure out that the back-tick is different from the quote.
> I am an elisp newbie. Is there an easy explanation of why we need a
> back-tick vs. quote?
>
> Also, I found that while the template works, it creates a new tree every
> time I capture an entry as follows
>

<snip>

> #1. Is there any way to consolidate this like the following?

You might check out a question I asked that's quite similar.
Basically... no, not unless the headline already exists. Then you have
to use file+olp instead of file+headline. Check out my example:
-- http://lists.gnu.org/archive/html/emacs-orgmode/2012-08/msg01465.html

Orgmode can file to a headline passed in the capture template
immediately after the =(... file+headline
"headline-to-file-under-here")=, but the longer =`(format...= tells
Org to insert that text every time. Thus, our sub-headline evaluation
will always create that text anew. The workaround will be for you to
re-arrange the =`(format...= section and put it above. In other words,
this:

----------
(setq org-capture-templates
`(("t" "test" entry
(file+headline "~/file.org"
,(format "%s"
(format-time-string "%m")))
,(format "** %s \n*** %s-%s \n**** [%s-%s-%s %s %s:%s] "
(format-time-string "%d")
(format-time-string "%Y")
(format-time-string "%A")
(format-time-string "%Y")
(format-time-string "%m")
(format-time-string "%d")
(format-time-string "%a")
(format-time-string "%H")
(format-time-string "%M"))
)))
----------

Needs to become something like this:
----------
(setq org-capture-templates
`(("t" "test" entry
(file+olp "~/file.org"
,(format "%s" ;; first headline
(format-time-string "%m")
,(format "%s" ;; second headline
(format-time-string "%d")
,(format "%s - %s"
(format-time-string "%Y")
(format-time-string "%A")))
,(format "**** [%s-%s-%s %s %s:%s] "
(format-time-string "%Y")
(format-time-string "%m")
(format-time-string "%d")
(format-time-string "%a")
(format-time-string "%H")
(format-time-string "%M"))
)))
----------

Something like that (I wrote this in email and didn't check it). That
tells Org to look for a *pre-existing* headline structure in this
form:
----------
* Month (in ## format, like 09 for September)
** Day (in ## format, like 06 for the 6th)
*** Year - Day (in #### - Name format like 2012 - Thursday
----------

And under that, it will file:
----------
**** [timestamp] what you write
----------

But... this means you need to pre-create your daily headline structure.

I think a reasonable feature request would be to have something like a
=:use-existing-capture-headline t= option that would tell Org to
*either* create a new capture headline (as on the first time used that
day) or file into a pre-existing headline if one already exists in
that form. Something like a hybrid between file+headline and file+olp.

Hope that makes sense. I think my example in the link above should help as well.

>
> * 09
> ** 05
> *** 2012 - Wednesday
> **** [2012-09-05 Wed 22:31] My first working month tree note
> **** [2012-09-05 Wed 22:35] My first working month tree note
>
> #2 The time always is reported as 22:31 (I guess that's the time I launched
> emacs). Is there a way for the time stamp to be corrected based on the
> current time? I generally leave emacs running for days together, so the time
> it's launched doesn't really work for me.

Did you change the above to 21:35 or did it file like that? Not sure
why H:M wouldn't expand to the current date. One thing that just
occurred to me, however, is to replace that whole timestamp string
with "%%U% and Org will just expand it to a date+time stamp.

Good luck,
John

>
> Once again, thanks a lot for your help!
>
> -c. b.
>
> On Sun, Aug 26, 2012 at 11:08 PM, John Hendy <jw.hendy@gmail.com> wrote:
>>
>> On Sun, Aug 26, 2012 at 11:04 PM, Nick Dokos <nicholas.dokos@hp.com>
>> wrote:
>> > John Hendy <jw.hendy@gmail.com> wrote:
>> >
>> >> On Sun, Aug 26, 2012 at 3:11 PM, c b <24x7x366@gmail.com> wrote:
>> >> > Hi,
>> >> >
>> >> > I have been using org-mode for about 18 months now and love it. I
>> >> > recently
>> >> > came across the org-capture file+datetree format and it is just what
>> >> > I am
>> >> > looking for, except that I need a slightly different format described
>> >> > as
>> >> > below
>> >> >
>> >> > Currently format is
>> >> >
>> >> > * 2012
>> >> > ** 2012-08
>> >> > *** 2012-08-26 Sunday
>> >> > **** [2012-08-26 Sun 13:00] My note for this Sunday afternoon
>> >> >
>> >> > Needed format is
>> >> >
>> >> > * 08
>> >> > ** 26
>> >> > *** 2012 Sunday
>> >> > **** [2012-08-26 Sun 13:00] My note for this Sunday afternoon
>> >> >
>> >> > Basically, I need to have the "root" of the date tree on the month,
>> >> > followed
>> >> > by date and then Year, so that for a particular date, I can see all
>> >> > yearly
>> >> > activity.
>> >> >
>> >> > Is there currently a way to alter this?
>> >> >
>> >> > If not, how would I go about adding a file+monthtree format for
>> >> > org-capture?
>> >> >
>> >> > Any suggestions would be appreciated
>> >>
>> >> I was looking for something similar and someone provided a custom
>> >> capture template that allowed for using inactive timestamps vs. the
>> >> default datetree format.
>> >>
>> >> See the example provided here:
>> >> - http://osdir.com/ml/emacs-orgmode-gnu/2012-08/msg00396.html
>> >>
>> >> I fiddled with this a bit, not really being familiar and learned a
>> >> good bit in the process to achieve your desired format. Give this a
>> >> try:
>> >>
>> >> #+begin_src .emacs
>> >> (setq org-capture-templates
>> >> `(("t" "test" entry
>> >> (file+headline "~/file.org"
>> >> ,(format "%s"
>> >> (format-time-string "%m")))
>> >> ,(format "** %s \n*** %s-%s \n**** [%s-%s-%s %s %s:%s] "
>> >> (format-time-string "%d")
>> >> (format-time-string "%Y")
>> >> (format-time-string "%A")
>> >> (format-time-string "%Y")
>> >> (format-time-string "%m")
>> >> (format-time-string "%d")
>> >> (format-time-string "%a")
>> >> (format-time-string "%H")
>> >> (format-time-string "%M"))
>> >> )))
>> >> #+end_src
>> >>
>> >> One thing I couldn't figure out was how to insert a %? after that
>> >> second long format option. If I just put in %?, loading .emacs caused
>> >> the error "Not enough arguments to format" or something like that. I'm
>> >> sure there's some secret elisp escape syntax I just don't know. I
>> >> tried various combinations of \ and '("") with no success.
>> >>
>> >
>> > Try
>> >
>> > --8<---------------cut here---------------start------------->8---
>> > ,(format "** %s \n*** %s-%s \n**** [%s-%s-%s %s %s:%s] %%?"
>> > --8<---------------cut here---------------end--------------->8---
>> >
>> > You basically need to escape the % from being interpreted by format.
>> > C-h f format RET says
>> >
>> > ,----
>> > | ...
>> > | Use %% to put a single % into the output.
>> > | ...
>> > `----
>>
>> Perfect -- thanks!
>> John
>>
>> >
>> > Nick
>> >
>> >> That'd put the finishing touch on things so your cursor was where you
>> >> wanted it.
>> >>
>> >> Also, for those seeing this... is this how you would accomplish c.b's
>> >> goal? I just used the sample provided to me in the earlier mailing
>> >> list email to see if I was up for the challenge, but I have no basis
>> >> for knowing whether it's a good solution.
>> >>
>> >>
>> >> Hope that helps!
>> >> John
>> >>
>> >> >
>> >> > Kindly copy me on the response as I am not subscribed to this mailing
>> >> > list.
>> >> >
>> >> > Thanks,
>> >> > c.b.
>> >>
>
>

  parent reply	other threads:[~2012-09-06 15:33 UTC|newest]

Thread overview: 217+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-26 20:11 Alternate format for datetree c b
2012-08-27  1:16 ` John Hendy
2012-08-27  4:04   ` Nick Dokos
2012-08-27  6:08     ` John Hendy
2012-08-28  8:49       ` Ian Barton
2012-08-28 12:49         ` Nick Dokos
2012-08-28 12:50         ` Nick Dokos
2012-08-29  7:49           ` Ian Barton
     [not found]             ` <lists@manor-farm.org>
2012-08-29 14:17               ` Nick Dokos
2012-08-29 14:25             ` John Hendy
2012-08-29 20:01               ` Ian Barton
2012-09-06  7:46                 ` Ian Barton
2012-09-06  5:42       ` c b
2012-09-06  6:26         ` Nick Dokos
2012-09-06  7:00         ` Jambunathan K
2012-09-06 15:33         ` John Hendy [this message]
2012-09-06 16:08           ` Jonathan Leech-Pepin
  -- strict thread matches above, loose matches on Subject: below --
2013-03-19 21:40 python sessions Gary Oberbrunner
2013-03-20  0:04 ` John Hendy
2013-03-20  3:07   ` Nick Dokos
2013-03-20  6:44     ` Andreas Röhler
2013-03-20 12:54       ` Ista Zahn
2013-03-20 14:08         ` Nick Dokos
2013-03-20 14:28           ` Gary Oberbrunner
2013-03-20 17:21         ` Andreas Röhler
2013-03-20  7:08   ` Andreas Röhler
2013-03-20 15:38     ` John Hendy
2013-03-20 15:42       ` John Hendy
2013-03-20 16:06       ` Nick Dokos
     [not found]         ` <CAFChFygsUeBejEY6m2bSU0C5cjLYz0nUADH=s+BYxajfZ2sKKQ@mail.gmail.com>
2013-03-20 16:12           ` Fwd: " Gary Oberbrunner
2013-03-20 17:08         ` Andreas Röhler
2013-03-20 17:25           ` Nick Dokos
2013-03-20 17:54             ` John Hendy
2013-03-20 18:15               ` Nick Dokos
2013-03-20 18:32                 ` Ista Zahn
2013-03-20 18:39                   ` Nick Dokos
2013-03-20 18:43                   ` Andreas Röhler
2013-03-20 19:42                     ` Ista Zahn
2013-03-20 19:53                       ` Andreas Röhler
2013-03-20 20:12                         ` Ista Zahn
2013-03-20 20:25                           ` Gary Oberbrunner
2013-03-20 22:06                             ` Ista Zahn
2013-03-20 18:42                 ` Andreas Röhler
2013-03-20 19:01             ` Andreas Röhler
     [not found]       ` <CAFChFygPrhuHHyMo2Vk2_OdksWVB=oACA7jnOXN+itUNqh-nqw@mail.gmail.com>
     [not found]         ` <CA+M2ft9bO7DU61vVeYrhduVvkg1V6PMuiyvsOy5tNWuXcSUEpw@mail.gmail.com>
     [not found]           ` <CAFChFyhbeXE4HNLKA6Ubii+MtQwD7=4khAypa+--coZrQiJekA@mail.gmail.com>
2013-03-21  1:22             ` Gary Oberbrunner
2013-03-21  1:54               ` John Hendy
2013-03-21  1:56                 ` Gary Oberbrunner
2013-03-21  7:42                   ` Andreas Röhler
2013-03-21  7:43                     ` Bastien
2013-03-21  8:13                       ` Andreas Röhler
2013-03-23 22:07                         ` Eric Schulte
2013-03-24  1:29                           ` John Hendy
2013-03-24 22:59                             ` Eric Schulte
2013-03-25  2:38                               ` Nick Dokos
2013-03-25  2:59                                 ` John Hendy
2013-03-25  6:34                                   ` Andreas Röhler
2013-03-25 15:40                                   ` Eric Schulte
2013-03-25 15:55                                     ` John Hendy
2013-03-25 16:07                                       ` Eric Schulte
2013-03-25 16:41                                         ` Nick Dokos
2013-03-25 16:01                                     ` Ista Zahn
2013-03-25 16:23                                       ` John Hendy
2013-03-25 16:43                                         ` Eric Schulte
2013-03-25 17:27                                           ` Andreas Röhler
2013-03-25 17:41                                             ` John Hendy
2013-03-25 18:16                                               ` Ista Zahn
2013-03-25 19:30                                             ` Ivan Andrus
2013-03-24  7:47                           ` Andreas Röhler
2013-03-24 14:47                             ` John Hendy
2013-03-24 15:30                               ` Andreas Röhler
2013-03-24 16:58                               ` Nick Dokos
2013-03-24 16:59                                 ` John Hendy
2013-03-24 18:41                                   ` Nick Dokos
2013-03-25 20:46                                     ` Andreas Röhler
2013-03-25 21:37                                       ` Eric Schulte
2013-03-26  6:29                                         ` Andreas Röhler
2013-03-26 12:32                                           ` Eric Schulte
2013-03-26 21:41                                             ` Gary Oberbrunner
2013-03-26 21:47                                               ` John Hendy
2013-03-27  6:19                                               ` Andreas Röhler
2013-03-30  7:19                                                 ` Andreas Röhler
2012-10-31  6:12 Bug? R: Org babel block execution *drastically* slower than in ESS session directly John Hendy
2012-10-31 16:41 ` cberry
2012-10-31 17:18   ` John Hendy
2012-10-31 20:12     ` cberry
2012-10-31 20:23       ` John Hendy
2012-10-31 20:56         ` Thomas S. Dye
2012-10-31 23:00           ` Nick Dokos
2012-10-31 22:53         ` Nick Dokos
2012-11-01 14:53           ` John Hendy
2012-11-01 15:38             ` Nick Dokos
2012-11-01 18:17               ` John Hendy
2012-11-01 18:18               ` John Hendy
2012-11-01 18:48                 ` Nick Dokos
2012-11-14  3:27                   ` Aaron Ecay
2012-11-14  4:52                     ` John Hendy
2012-11-14  6:32                       ` Aaron Ecay
2012-11-14  8:28                         ` Thomas S. Dye
2012-11-14  8:35                           ` Andreas Leha
2012-11-16 15:45                             ` Eric Schulte
2012-11-16 17:47                               ` Andreas Leha
2012-11-16 19:00                                 ` John Hendy
2012-11-16 20:25                                 ` Achim Gratz
2012-11-17 17:12                                   ` Eric Schulte
2012-11-18  0:41                               ` Aaron Ecay
2012-11-18  0:57                                 ` Eric Schulte
2012-11-18  1:41                                   ` Aaron Ecay
2012-11-19  1:18                                     ` Eric Schulte
2012-11-19  5:11                                       ` Eric Schulte
2011-11-02  2:22 Pass LaTeX exporter option prior to \documentclass John Hendy
2011-11-02  2:43 ` suvayu ali
2011-11-02 10:30   ` suvayu ali
2011-11-03 17:48     ` John Hendy
2011-11-03 17:55       ` suvayu ali
2011-11-03 18:07         ` John Hendy
2011-11-04 17:29           ` Nick Dokos
2011-11-04 19:29             ` suvayu ali
2011-10-19 14:54 Prompt for time when clocking in? Nathan Neff
2011-10-19 15:12 ` John Hendy
2011-10-19 15:35   ` Nick Dokos
2011-10-20 16:15     ` Nathan Neff
2011-10-20 17:09       ` Nick Dokos
2011-10-20 17:44         ` Nathan Neff
2011-10-19 16:37 ` Bernt Hansen
2011-08-05 22:15 Handling errors in command line exporting of agenda? John Hendy
2011-08-05 23:34 ` suvayu ali
2011-08-05 23:35   ` suvayu ali
2011-08-08 18:12   ` John Hendy
2011-08-08 18:28     ` suvayu ali
2011-08-08 18:53       ` John Hendy
2011-08-08 18:59         ` suvayu ali
2011-08-08 19:48           ` John Hendy
2011-08-08 20:22             ` suvayu ali
2011-08-08 20:31               ` John Hendy
2011-08-08 20:33               ` Nick Dokos
2011-08-08 20:37             ` Nick Dokos
2011-08-08 20:54               ` John Hendy
2011-08-08 21:09                 ` Nick Dokos
2011-08-08 21:27                   ` John Hendy
2011-08-08 21:30               ` suvayu ali
2011-08-08 22:17                 ` Nick Dokos
2011-08-08 21:46             ` suvayu ali
2011-06-15 10:29 BUG: Newest org-mode interferes with desktop save Rainer M Krug
2011-06-15 16:49 ` Eric Schulte
2011-06-15 17:35   ` Nick Dokos
2011-06-15 18:23     ` Rainer M Krug
2011-06-15 18:21   ` Rainer M Krug
2011-06-15 18:31     ` Eric Schulte
2011-06-15 18:59       ` Rainer M Krug
2011-06-15 22:40         ` Nick Dokos
2011-06-16  7:15           ` Rainer M Krug
2011-06-16  7:29             ` Jambunathan K
2011-06-16  8:22               ` Rainer M Krug
2011-05-24 15:54 Passing font size to exported LaTeX table John Hendy
2011-05-24 16:44 ` Sebastien Vauban
2011-05-24 18:57   ` John Hendy
2011-05-24 19:25     ` Nick Dokos
2011-05-24 19:31       ` John Hendy
2011-05-24 19:58         ` Thomas S. Dye
2011-05-24 20:42           ` Nick Dokos
2011-05-24 21:12             ` Nick Dokos
2011-05-24 21:19               ` Nick Dokos
2011-05-25  7:22                 ` Thomas S. Dye
2011-05-27  0:58                   ` suvayu ali
2011-05-27  6:46                     ` Thomas S. Dye
2011-05-27  7:07                       ` suvayu ali
2011-05-27 16:17                         ` Thomas S. Dye
2011-05-27 16:50                           ` Suvayu Ali
2011-05-27 17:37                             ` Thomas S. Dye
2011-05-27 18:30                               ` Suvayu Ali
2011-05-27 21:25                                 ` Thomas S. Dye
2011-05-28  7:17                                   ` Sebastien Vauban
2011-05-28 10:14                                     ` Suvayu Ali
2011-05-28 15:21                                       ` Nick Dokos
2011-05-28 18:10                                         ` Suvayu Ali
2011-06-01 18:50                                   ` Nick Dokos
2011-06-01 19:08                                     ` Suvayu Ali
2011-06-10 22:31                                       ` Suvayu Ali
2011-06-13  1:38                                         ` suvayu ali
2011-06-13  1:52                                         ` Nick Dokos
2011-06-13  2:40                                           ` Suvayu Ali
2011-06-13  3:29                                             ` Nick Dokos
2011-06-13  3:45                                           ` Thomas S. Dye
2011-06-13  4:27                                             ` Nick Dokos
2011-06-13  4:56                                               ` Suvayu Ali
2011-06-13  5:29                                                 ` Nick Dokos
2011-06-13  6:42                                                   ` Suvayu Ali
2011-05-24 20:06         ` Nick Dokos
2011-05-24 19:42       ` Sebastien Vauban
2010-08-21 19:30 Gnuplot unevenly spaced non-numeric data plot? John Hendy
2010-08-21 20:35 ` Eric S Fraga
2010-08-21 20:41 ` Nick Dokos
2010-08-21 21:11   ` John Hendy
2010-08-21 22:41     ` John Hendy
2010-08-21 23:17       ` Nick Dokos
2010-08-23 14:22         ` John Hendy
2010-08-23 15:16           ` Nick Dokos
     [not found]             ` <AANLkTi=WTLBL1Giq0GTrjCo-A1s=iP4u1Qxn57cH-xnB@mail.gmail.com>
     [not found]               ` <AANLkTimSVm=-2o39CQ9wSMT276Dee4Tuj9jLKJH-c+cd@mail.gmail.com>
2010-08-24  2:44                 ` [For Worg?] " John Hendy
2010-08-24  5:25                   ` suvayu ali
2010-08-24  5:56               ` Nick Dokos
2010-08-25  0:32                 ` Eric Schulte
2010-08-25  1:06                   ` John Hendy
2010-08-25  1:35                     ` Eric Schulte
2010-08-25 18:38                       ` John Hendy
2010-08-25 18:52                         ` Eric Schulte
     [not found]         ` <jw.hendy@gmail.com>
2012-03-12 21:13           ` Beamer specific setupfile? John Hendy
2012-03-12 21:48             ` Nick Dokos
2012-03-12 22:09               ` John Hendy
2012-03-12 22:30                 ` Nick Dokos
2012-03-12 22:44                   ` Nick Dokos
2012-03-13  5:02                     ` John Hendy
2012-03-13  5:46                       ` Nick Dokos
2012-04-25  8:16                         ` Eric Fraga
2012-04-25  8:59                           ` Eric Fraga
2012-03-12 23:01                 ` Nick Dokos
2012-03-12 21:51             ` Nick Dokos
2012-03-12 22:05             ` Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+M2ft9kM8nu5CDATME6G+tXzYdFdGStO6nJwsNDGedWm2VibA@mail.gmail.com \
    --to=jw.hendy@gmail.com \
    --cc=24x7x366@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).