From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Barton Subject: Re: Alternate format for datetree Date: Tue, 28 Aug 2012 09:49:31 +0100 Message-ID: <503C861B.2040002@wilkesley.net> References: <20532.1346040247@alphaville> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6HUv-0007lH-4d for emacs-orgmode@gnu.org; Tue, 28 Aug 2012 04:50:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T6HUp-0007tq-9P for emacs-orgmode@gnu.org; Tue, 28 Aug 2012 04:50:09 -0400 Received: from mail2.wilkesley.net ([109.74.196.44]:40768 helo=li40-130.members.linode.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6HUp-0007c2-1O for emacs-orgmode@gnu.org; Tue, 28 Aug 2012 04:50:03 -0400 Received: from [192.168.1.22] (86-45-251-106-dynamic.b-ras3.mvw.galway.eircom.net [86.45.251.106]) (Authenticated sender: ian@wilkesley.net) by li40-130.members.linode.com (Postfix) with ESMTPSA id B4FEB5EC9B4 for ; Tue, 28 Aug 2012 09:49:38 +0100 (BST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On 27/08/12 07:08, John Hendy wrote: > On Sun, Aug 26, 2012 at 11:04 PM, Nick Dokos wrote: >> John Hendy 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. >>> I would like to use something like this. However, using a recent git checkout of org mode and the following simple template from the original list message: ("u" "Test" entry (file+headline "~/test.org" ,(format "%s %s" (format-time-string "%B") (format-time-string "%Y")))) I get the following error: Debugger entered--Lisp error: (wrong-type-argument stringp (\, (format "%s %s" (format-time-string "%B") (format-time-string "%Y")))) regexp-quote((\, (format "%s %s" (format-time-string "%B") (format-time-string "%Y")))) org-capture-set-target-location() org-capture(nil) call-interactively(org-capture nil nil) I also get the same error from John Hendy's template. Is this a bug in recent versions of org, or is there an error in the template lisp? I have tried doing a git bisect, but can only go back a few commits, as my config now includes several things that have only recently been added to org. Ian.