From: Marcin Borkowski <mbork@mbork.pl>
To: Joost Kremers <joostkremers@fastmail.fm>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: How to replace format-like codes in a string?
Date: Fri, 11 Nov 2016 13:19:45 +0100 [thread overview]
Message-ID: <87k2ca6wf2.fsf@mbork.pl> (raw)
In-Reply-To: <877f8afllx.fsf@fastmail.fm>
On 2016-11-11, at 09:48, Joost Kremers <joostkremers@fastmail.fm> wrote:
> On Fri, Nov 11 2016, Marcin Borkowski wrote:
>> I want to write a function like `format', which gets a string
>> with some
>> codes embedded (like "%a", "%b" etc., and "%%" to get a
>> percentage
>> sign), and convert them to something (say, "%a" to the value of
>> var-a,
>> "%b" to var-b etc.). Is there any facility in Elisp to help
>> with that
>> or do I have to do a search-and-replace manually?
>
> See `format-spec' and `format-spec-make'.
Thanks a lot! That was exactly what I needed. (I mean, `format-spec';
I'm not sure why I would need `format-spec-make', assuming that I can
just use backquote and comma.)
Best,
--
Marcin Borkowski
next prev parent reply other threads:[~2016-11-11 12:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-11 8:25 How to replace format-like codes in a string? Marcin Borkowski
2016-11-11 8:48 ` Joost Kremers
2016-11-11 12:19 ` Marcin Borkowski [this message]
2016-11-13 10:29 ` Joost Kremers
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=87k2ca6wf2.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=help-gnu-emacs@gnu.org \
--cc=joostkremers@fastmail.fm \
/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).