emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Templates for cloning


From: Sebastian Fischmeister
Subject: Re: [O] Templates for cloning
Date: Wed, 8 Aug 2012 20:42:30 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

The comment about swapping lines and getting a nicer version was
intended for the orgmode devs, just in case they want an easy way to
support templates with minimal changes to the source code.

My solution also works. Just copy the elisp definitions for org-p and
org-g into your .emacs file. Then define a new template and you're
set.

In the template:

- %(org-p "varname") will prompt you for a value that is then stored as
 'varname'.

- %(org-g "varname") will then insert the text you entered at the
 prompt.


  Sebastian


On 08/05/12 08:35pm, Nathan Neff wrote:
> On Fri, Aug 3, 2012 at 9:40 PM, Sebastian Fischmeister
> <address@hidden> wrote:
> > As an idea, this is how I use templates:
> >
> > %+begin_src
> > (defun org-p (key)
> >   (let ((val (read-from-minibuffer (concat "Define " key ": "))))
> >     (plist-put org-store-link-plist
> >                (intern (concat ":" key)) val))
> >   ""
> >   )
> >
> > (defmacro org-g (key)
> >   (or (plist-get org-store-link-plist (intern (concat ":" key)))
> >   (concat "MISSING-KEY-" key)))
> >
> > (setq org-capture-templates
> >        (quote (("p4" "Template: Bla" plain (file+headline
> >        "~/.org/todo.org" "Projects") (file "~/.org/templates/bla.tmpl")))))
> > %+end_src
> >
> > %+begin_src yasnippet
> > %(org-p "var1")
> > %(org-p "var2")
> > ** Now copy here %(org-g "var1")
> > ** And here %(org-g "var1")
> >    SCHEDULED: %^t
> > %+end_src
> >
> > If you just swap the sequence of the buffer evaluation in
> > org-capture-fill-template, then you would even have a nicer version of
> > this. See this previous post for details:
> >
> > http://comments.gmane.org/gmane.emacs.orgmode/57248
> >
> >   Sebastian
> >
> 
> Sebastian, thanks for your suggestion, but I'm having trouble understanding
> how your solution works, and I don't know what you mean by "If you just swap
> the sequence of the buffer evaluation".  I only glanced at your suggestion and
> will review it later (hopefully).
> 
> If you can point me to more documentation about what's going on in
> your solution,
> or perhaps enlighten me a bit more, I would appreciate it!
> 
> Thanks,
> --Nate



reply via email to

[Prev in Thread] Current Thread [Next in Thread]