unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Robert Thorpe <rt@robertthorpeconsulting.com>
To: Marcin Borkowski <mbork@wmi.amu.edu.pl>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Template substitution in Emacs?
Date: Wed, 12 Nov 2014 03:31:30 +0000	[thread overview]
Message-ID: <87oasd9jsd.fsf@robertthorpeconsulting.com> (raw)
In-Reply-To: <87bnogc6ex.fsf@wmi.amu.edu.pl> (message from Marcin Borkowski on Mon, 10 Nov 2014 00:15:18 +0100)

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
> Hi there,
>
> assume that I want to insert an (almost) constant string in Emacs
> buffer.  For instance, it may be a string of the form
>
> "I am a {my-variable}."
>
> However, I want the "{my-variable}" part to be, well, variable: I want
> to substitute the current value of `my-variable' for this.  So that
>
> (setq my-variable "sentence")
> (insert (template-substitute "I am a {my-variable}."))
>
> would insert "I am a sentence." at point.

As well as the things others have mentioned there's skeleton.el which is
part of Emacs.

BR,
Robert Thorpe



  parent reply	other threads:[~2014-11-12  3:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-09 23:15 Template substitution in Emacs? Marcin Borkowski
2014-11-10  2:13 ` Eric Abrahamsen
2014-11-10  2:16 ` Paul W. Rankin
2014-11-10  4:18 ` Pierre Lorenzon
2014-11-12  3:31 ` Robert Thorpe [this message]
2014-11-12 19:58   ` Pierre Lorenzon

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oasd9jsd.fsf@robertthorpeconsulting.com \
    --to=rt@robertthorpeconsulting.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=mbork@wmi.amu.edu.pl \
    /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.
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).