From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: How to replace format-like codes in a string? Date: Fri, 11 Nov 2016 09:25:07 +0100 Message-ID: <87mvh677a4.fsf@mbork.pl> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1478852787 27739 195.159.176.226 (11 Nov 2016 08:26:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Nov 2016 08:26:27 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 26.0.50.3 To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 11 09:26:23 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 1c57A6-0005nV-Jh for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Nov 2016 09:26:14 +0100 Original-Received: from localhost ([::1]:51298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c57A9-0000Vv-P5 for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Nov 2016 03:26:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c579S-0000Un-HO for help-gnu-emacs@gnu.org; Fri, 11 Nov 2016 03:25:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c579N-0000Hs-Fi for help-gnu-emacs@gnu.org; Fri, 11 Nov 2016 03:25:34 -0500 Original-Received: from mail.mojserwer.eu ([2a01:5e00:2:52::8]:43015) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c579N-0000Gy-8A for help-gnu-emacs@gnu.org; Fri, 11 Nov 2016 03:25:29 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id CBF5DE6599 for ; Fri, 11 Nov 2016 09:25:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s_ho-wrGmfDu for ; Fri, 11 Nov 2016 09:25:12 +0100 (CET) Original-Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 775FCE62EB for ; Fri, 11 Nov 2016 09:25:06 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2a01:5e00:2:52::8 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:111709 Archived-At: Hi list, 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? Best, -- Marcin Borkowski