From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: How to replace format-like codes in a string? Date: Fri, 11 Nov 2016 09:48:26 +0100 Message-ID: <877f8afllx.fsf@fastmail.fm> References: <87mvh677a4.fsf@mbork.pl> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: blaine.gmane.org 1478854169 13135 195.159.176.226 (11 Nov 2016 08:49:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Nov 2016 08:49:29 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 25.1.50.3 Cc: Help Gnu Emacs mailing list To: Marcin Borkowski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 11 09:49:25 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c57W4-000855-8f for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Nov 2016 09:48:56 +0100 Original-Received: from localhost ([::1]:51401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c57W7-0005vw-Gj for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Nov 2016 03:48:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c57Vg-0005vr-AK for help-gnu-emacs@gnu.org; Fri, 11 Nov 2016 03:48:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c57Vd-0000DJ-7F for help-gnu-emacs@gnu.org; Fri, 11 Nov 2016 03:48:32 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:39688) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c57Vd-0000DB-1t for help-gnu-emacs@gnu.org; Fri, 11 Nov 2016 03:48:29 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7616D21673; Fri, 11 Nov 2016 03:48:28 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Fri, 11 Nov 2016 03:48:28 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=sw2bL8qRLP0wl7WTyl+JMtuZL2A=; b=GgUIUP HDx9EdBqZHAQDWO9xZL9noE7sUlA7ZZOlh5i2ROp2NNzIP/cUcKiTtWYRIIoB3MD nDGVVJkrkMchbTlahUJptCzyAxGWERLJSFn+EBY5kuJXlLE15AdKgONdZfm6ydvm YERFSnnNxV1L4/6+Xp7YXWNImPSIItuu8qwTQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=sw2bL8qRLP0wl7 WTyl+JMtuZL2A=; b=uzDNbaiCSzRE5HhjJeVs6Jzyq66AMeuv2mmVP8YYgUXQJZ 2ViL+s8IFXW+vK7SWdTM65YDaw2UHHXnuyxLxTWQ1edaKTMFQdqFMMz2YjBqNxHP S0vmHml7S8PLl5t1T9F/uc1KWUUHUzFJG95H/et67HyjX2+oPD3p/AzWHQQi4= X-ME-Sender: X-Sasl-enc: 67KRIuA0A2ZhQvTEaSvt+zrEKOkPKndyge3LL/fP1Xg5 1478854107 Original-Received: from IdeaPad.messagingengine.com (x4d0aa9e6.dyn.telefonica.de [77.10.169.230]) by mail.messagingengine.com (Postfix) with ESMTPA id BABEB7E436; Fri, 11 Nov 2016 03:48:27 -0500 (EST) In-reply-to: <87mvh677a4.fsf@mbork.pl> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.28 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111710 Archived-At: 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'. -- Joost Kremers Life has its moments