Re: [O] Alternate format for datetree

2012-09-06 Thread Nick Dokos
c b 24x7x...@gmail.com wrote:

 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?
 

quote says: take the next expression as is - do not evaluate anything in it.

backquote says: take the next expression as is - do not evaluate
  anything in it, *except* do evaluate any subexpression
  preceded by a comma and put the result back into the original
  expression in place of the comma-ed subexpression.

E.g

'(a b c) - (a b c)
`(a b c) - (a b c)  ; because there is no comma

'(a (+ 2 3)) - (a (+ 2 3))
`(a (+ 2 3)) - (a (+ 2 3)) ; again no comma
`(a ,(+ 2 3)) - (a 5)

Incidentally, if you switch to the *scratch* buffer (which is in Lisp
Interaction mode), you can type these expressions in and evaluate each
one by pressing C-j at the end of each expression.

So they both quote: the first one unconditionally, the second mostly but
allowing partial evaluation of subexpressions.

BTW, '(a b c) is shorthand for (quote (a b c)): internally, the lisp
reader translates the first to the second and then the evaluator
evaluates the quote form, returning its (unevaluated) argument: that's
why quote is a special form - by contrast, ordinary functions always
evaluate their arguments.

`(a b ,(+ 2 3)) is also shorthand for (backquote (a b ,(+ 2 3))) but the
implementation is necessarily more complicated: backquote is implemented
as a macro (because it is a special form, its argument is not evaluated,
so it cannot be implemented as a function; it has to be implemented as a
macro), but then backquote has to dig into the structure to look for ,
(and also for the somewhat different ,@ construct - see the docs) and do what's
necessary.

Another example is provided by the docstring of backquote itself: C-h f
backquote RET to see it.

For more info, see the elisp manual, chapter 9 on evaluation:

 (info (elisp) Evaluation)

and two sections therein in particular, 9.3 Quoting, and 9.4 Backquote:

(info (elisp) Quoting)
(info (elisp) Backquote)

Nick




Re: [O] Alternate format for datetree

2012-09-06 Thread Jambunathan K
c b 24x7x...@gmail.com writes:

 It took a while to figure out that the back-tick is different from the
 quote.

Two useful links in this respect.

http://www.lisperati.com/syntax.html
http://www.lisperati.com/looking.html

Just focus on the diagrams in the link - particularly the flip-flop
diagram in the second link.  Once you have the flip-flop image in mind,
you will realize that characters ` and , are also rotated 180
degrees and are actually flip-flops.

Now try mapping what flip to don't evaluate and flop to evaluate.

Then you can move on to what Nick says or the doc says.
-- 



Re: [O] Alternate format for datetree

2012-09-06 Thread Ian Barton

On 29/08/12 21:01, Ian Barton wrote:

On 29/08/12 15:25, John Hendy wrote:

On Wed, Aug 29, 2012 at 2:49 AM, Ian Barton li...@manor-farm.org wrote:

On 28/08/12 13:50, Nick Dokos wrote:


Ian Barton li...@wilkesley.net wrote:


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.



You are missing the backquote:

--8---cut here---start-8---
   `(u
Test
entry
(file+headline ~/test.org
   ,(format %s %s
(format-time-string %B)
(format-time-string %Y
--8---cut here---end---8---

Nick


Thanks Nick. Hwever with the following minimal template, from the OP, I
still get the error:

;; org-capture settings.
(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))
)))


Odd. I just copied and pasted this into my .emacs and commented out my
actual capture templates section entirely, leaving only this and it
works as expected.

(Just saw Nick's response as well and was going to both try and
suggest similar with a minimal .emacs).




Thanks both. I'll try with a minimal emacs and post the results.
However, it may be a day or two as I am currently in the far West of
Ireland with very variable Internet connections
!


Now back with a reliable Internet connection. Thanks for the minimal 
example, which worked correctly. In my full setup, I have quite a lot of 
template definitions. It turned out that I had put the backquote the 
wrong side of a bracket.


Ian.




Re: [O] Alternate format for datetree

2012-09-06 Thread John Hendy
On Thu, Sep 6, 2012 at 12:42 AM, c b 24x7x...@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.he...@gmail.com wrote:

 On Sun, Aug 26, 2012 at 11:04 PM, Nick Dokos nicholas.do...@hp.com
 wrote:
  John Hendy jw.he...@gmail.com wrote:
 
  On Sun, Aug 26, 2012 at 3:11 PM, c b 24x7x...@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 

Re: [O] Alternate format for datetree

2012-09-06 Thread Jonathan Leech-Pepin
Hello,

On Thu, Sep 6, 2012 at 11:33 AM, John Hendy jw.he...@gmail.com wrote:
 On Thu, Sep 6, 2012 at 12:42 AM, c b 24x7x...@gmail.com wrote:
 Hi John and Nick,


[snip]


 * 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

This is actually an issue with all of the backtick elements in the
capture template but it shows up most obviously in the timestamp
portion.  I only realized this after providing the solution that John
had referenced earlier in this thread.  Backticks are expanded on
evaluation and resolve to the specific value of their called portions.
 So for the headlines you will need to re-evaluate the template every
day to update it (or restart emacs).

For the timestamp itself you should be able to use the %U escape in
the capture template and it will insert the date and time on it's own.

Regards,

--
Jon



Re: [O] Alternate format for datetree

2012-09-05 Thread c b
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

* 09
** 05
*** 2012 - Wednesday
 [2012-09-05 Wed 22:31] My first working month tree note

* 09
** 05
*** 2012 - Wednesday
 [2012-09-05 Wed 22:31] My second month tree note

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

* 09
** 05
*** 2012 - Wednesday
 [2012-09-05 Wed 22:31] My first working month tree note
 [2012-09-05 Wed 22:3*5*] 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.

Once again, thanks a lot for your help!

-c. b.

On Sun, Aug 26, 2012 at 11:08 PM, John Hendy jw.he...@gmail.com wrote:

 On Sun, Aug 26, 2012 at 11:04 PM, Nick Dokos nicholas.do...@hp.com
 wrote:
  John Hendy jw.he...@gmail.com wrote:
 
  On Sun, Aug 26, 2012 at 3:11 PM, c b 24x7x...@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.
 



Re: [O] Alternate format for datetree

2012-08-29 Thread Ian Barton

On 28/08/12 13:50, Nick Dokos wrote:

Ian Barton li...@wilkesley.net wrote:


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.



You are missing the backquote:

--8---cut here---start-8---
  `(u
   Test
   entry
   (file+headline ~/test.org
  ,(format %s %s
   (format-time-string %B)
   (format-time-string %Y
--8---cut here---end---8---

Nick

Thanks Nick. Hwever with the following minimal template, from the OP, I 
still get the error:


;; org-capture settings.
(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))
)))

Ian.



Re: [O] Alternate format for datetree

2012-08-29 Thread Nick Dokos
Ian Barton li...@manor-farm.org wrote:


 Thanks Nick. Hwever with the following minimal template, from the OP,
 I still get the error:
 
 ;; org-capture settings.
 (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))
 )))
 

I put this in a minimal .emacs and I *do not* get an error. Please try
the appended minimal .emacs (change the pathnames appropriately) with

emacs -q -l /path/to/minimal/.emacs

M-x org-capture RET t
M-x org-capture RET u

and post the backtrace if any. Both of them work fine for me. You are
sure you used a backquote?

Nick

--8---cut here---start-8---
;;; -*- mode: emacs-lisp -*-
;;; constant part
(add-to-list 'load-path (expand-file-name ~/src/emacs/org/org-mode/lisp))
(add-to-list 'load-path (expand-file-name 
~/src/emacs/org/org-mode/contrib/lisp))

(add-to-list 'auto-mode-alist '(\\.\\(org\\|org_archive\\|txt\\)$ . org-mode))

(require 'org-install)

(setq debug-on-error t)
(setq debug-on-quit t)
(setq eval-expression-print-length nil)
(setq eval-expression-print-level nil)

(global-set-key \C-cl 'org-store-link)
(global-set-key \C-ca 'org-agenda)

;;; variable part
;; org-capture settings.
(setq org-capture-templates
  `((t test entry
 (file+headline ~/test.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))
 )
(u Test entry
 (file+headline ~/test.org
,(format %s %s
 (format-time-string %B)
 (format-time-string %Y))
--8---cut here---end---8---



Re: [O] Alternate format for datetree

2012-08-29 Thread John Hendy
On Wed, Aug 29, 2012 at 2:49 AM, Ian Barton li...@manor-farm.org wrote:
 On 28/08/12 13:50, Nick Dokos wrote:

 Ian Barton li...@wilkesley.net wrote:

 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.


 You are missing the backquote:

 --8---cut here---start-8---
   `(u
Test
entry
(file+headline ~/test.org
   ,(format %s %s
(format-time-string %B)
(format-time-string %Y
 --8---cut here---end---8---

 Nick

 Thanks Nick. Hwever with the following minimal template, from the OP, I
 still get the error:

 ;; org-capture settings.
 (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))
 )))

Odd. I just copied and pasted this into my .emacs and commented out my
actual capture templates section entirely, leaving only this and it
works as expected.

(Just saw Nick's response as well and was going to both try and
suggest similar with a minimal .emacs).


John


 Ian.




Re: [O] Alternate format for datetree

2012-08-29 Thread Ian Barton

On 29/08/12 15:25, John Hendy wrote:

On Wed, Aug 29, 2012 at 2:49 AM, Ian Barton li...@manor-farm.org wrote:

On 28/08/12 13:50, Nick Dokos wrote:


Ian Barton li...@wilkesley.net wrote:


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.



You are missing the backquote:

--8---cut here---start-8---
   `(u
Test
entry
(file+headline ~/test.org
   ,(format %s %s
(format-time-string %B)
(format-time-string %Y
--8---cut here---end---8---

Nick


Thanks Nick. Hwever with the following minimal template, from the OP, I
still get the error:

;; org-capture settings.
(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))
)))


Odd. I just copied and pasted this into my .emacs and commented out my
actual capture templates section entirely, leaving only this and it
works as expected.

(Just saw Nick's response as well and was going to both try and
suggest similar with a minimal .emacs).




Thanks both. I'll try with a minimal emacs and post the results. 
However, it may be a day or two as I am currently in the far West of 
Ireland with very variable Internet connections

!

Ian.





Re: [O] Alternate format for datetree

2012-08-28 Thread Ian Barton

On 27/08/12 07:08, John Hendy wrote:

On Sun, Aug 26, 2012 at 11:04 PM, Nick Dokos nicholas.do...@hp.com wrote:

John Hendy jw.he...@gmail.com wrote:


On Sun, Aug 26, 2012 at 3:11 PM, c b 24x7x...@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.





Re: [O] Alternate format for datetree

2012-08-28 Thread Nick Dokos




Re: [O] Alternate format for datetree

2012-08-28 Thread Nick Dokos
Ian Barton li...@wilkesley.net wrote:

 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.
 

You are missing the backquote:

--8---cut here---start-8---
 `(u
  Test
  entry
  (file+headline ~/test.org
 ,(format %s %s
  (format-time-string %B)
  (format-time-string %Y
--8---cut here---end---8---

Nick



Re: [O] Alternate format for datetree

2012-08-27 Thread John Hendy
On Sun, Aug 26, 2012 at 11:04 PM, Nick Dokos nicholas.do...@hp.com wrote:
 John Hendy jw.he...@gmail.com wrote:

 On Sun, Aug 26, 2012 at 3:11 PM, c b 24x7x...@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.




[O] Alternate format for datetree

2012-08-26 Thread c b
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

Kindly copy me on the response as I am not subscribed to this mailing list.

Thanks,
c.b.


Re: [O] Alternate format for datetree

2012-08-26 Thread John Hendy
On Sun, Aug 26, 2012 at 3:11 PM, c b 24x7x...@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.

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.



Re: [O] Alternate format for datetree

2012-08-26 Thread Nick Dokos
John Hendy jw.he...@gmail.com wrote:

 On Sun, Aug 26, 2012 at 3:11 PM, c b 24x7x...@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.
| ...
`

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.