emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Fischmeister <sfischme@uwaterloo.ca>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Templates for cloning
Date: Fri, 3 Aug 2012 22:40:48 -0400	[thread overview]
Message-ID: <20120804024048.GQ21653@muh> (raw)
In-Reply-To: <87vch0xua8.fsf@altern.org>

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

On 08/03/12 09:25am, Bastien wrote:
> Hi Nathan,
> 
> Nathan Neff <nathan.neff@gmail.com> writes:
> 
> > Is there a way to create a template structure for cloning?
> 
> This is something I've wanted for long, and I hope I'll find the time 
> to implement it after 7.9.
> 
> More precisely, I want something that captures the structure of the
> subtree at point (with all elements), then let's you convert this
> structure into a template for later interactive insertion.
> 
> > Does anyone know of a way to do this?
> 
> I guess yasnippet can help to produce something close to what you want
> for now.
> 
> Best,

  reply	other threads:[~2012-08-04  2:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02 17:12 Templates for cloning Nathan Neff
2012-08-03  7:25 ` Bastien
2012-08-04  2:40   ` Sebastian Fischmeister [this message]
2012-08-06  1:35     ` Nathan Neff
2012-08-09  0:42       ` Sebastian Fischmeister

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=20120804024048.GQ21653@muh \
    --to=sfischme@uwaterloo.ca \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /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).