[Orgmode] sexp in org remember templates

2009-10-26 Thread Richard Riley

Not being much of an elisp programmer and just returning to try and
integrate with org-learn a little :-

This 

  (vocab?v * Learn TODO %(format '%s' rgr/orig-word)
  :VOCAB:\n:PROPERTIES:\n:orig:\t%(format '%s'
  rgr/orig-word)\n:trans:\t%(format '%s'
  rgr/trans-word)\n:END:%! nil bottom nil)

fails me by outputting:

,
| * Learn TODO [Error: (wrong-type-argument stringp %s)]  
:VOCAB:
| :PROPERTIES:
| :orig:%![Error: (wrong-type-argument stringp %s)]
| :trans:   %![Error: (wrong-type-argument stringp %s)]
| :END:%!
`

both rgr/orig-word and rgr/trans-word are set as strings.

Q1 : can I use an elisp var directly as opposed to simulating a func like
above?
Q2 : What is wrong with the above? Whats wrong with that format of a
sexp?
Q3 : how can I specify in the template to auto schedule a TODO for n
days in advance?



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] sexp in org remember templates

2009-10-26 Thread Nick Dokos
Richard Riley rileyrg...@gmail.com wrote:

 
 Not being much of an elisp programmer and just returning to try and
 integrate with org-learn a little :-
 
 This 
 
 (vocab?v * Learn TODO %(format '%s' rgr/orig-word)
 :VOCAB:\n:PROPERTIES:\n:orig:\t%(format '%s'
 rgr/orig-word)\n:trans:\t%(format '%s'
 rgr/trans-word)\n:END:%! nil bottom nil)
 
 fails me by outputting:
 

At the very least, you need to avoid single quotes for quoting strings -
a single quote has a very special meaning to lisp in general: it inhibits
evaluation of the following sexp.

Try something like this instead:

(vocab?v * Learn TODO %(format \%s\ rgr/orig-word)
  :VOCAB:\n:PROPERTIES:\n:orig:\t%(format \%s\
  rgr/orig-word)\n:trans:\t%(format \%s\
  rgr/trans-word)\n:END:%! nil bottom nil)

However, no guarantees: when (or even whether) the format calls will be executed
(let alone whether they'll produce the correct result) depends on the
code that handles this construct. There have been a couple of questions
on the mailing list about such evaluations in the context of
org-remember-templates, and IIRC, Carsten had added an evaluation
mechanism there - see e.g. the thread at

   http://thread.gmane.org/gmane.emacs.orgmode/14521

and another thread referenced therein for some details. But I don't know
if this will do what you need it to do.

HTH,
Nick



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode