From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Vivek Dasmohapatra Newsgroups: gmane.emacs.devel Subject: Re: (format "Hello %1$S%2$s" 'world "!") Date: Sun, 2 Jul 2017 17:56:43 +0100 (BST) Message-ID: References: <061782A1-0A51-49A1-9AA4-706AF8927D01@gmail.com> <94EF128F-6A3D-41DD-B92D-0C165A4A8EB9@gmail.com> <617557F2-0316-4504-BE80-E7F29E4EE347@gmail.com> <86E604C6-4A01-42D2-A3CD-D758FC5DD8B1@gmail.com> <6fc86e25-4515-0787-d984-9160bc9c15e7@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-21034188-1499014608=:31053" X-Trace: blaine.gmane.org 1499014636 32429 195.159.176.226 (2 Jul 2017 16:57:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Jul 2017 16:57:16 +0000 (UTC) User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) Cc: Emacs developers , Noam Postavsky To: =?ISO-8859-15?Q?Cl=E9ment_Pit-Claudel?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 02 18:57:12 2017 Return-path: Envelope-to: ged-emacs-devel@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 1dRiBD-0007oI-DW for ged-emacs-devel@m.gmane.org; Sun, 02 Jul 2017 18:57:03 +0200 Original-Received: from localhost ([::1]:58655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRiBI-0007MF-Qq for ged-emacs-devel@m.gmane.org; Sun, 02 Jul 2017 12:57:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRiBC-0007M8-51 for emacs-devel@gnu.org; Sun, 02 Jul 2017 12:57:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dRiB7-0004dd-At for emacs-devel@gnu.org; Sun, 02 Jul 2017 12:57:02 -0400 Original-Received: from ceres.etla.org ([85.119.82.193]:35634) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dRiB7-0004Y6-3h for emacs-devel@gnu.org; Sun, 02 Jul 2017 12:56:57 -0400 Original-Received: from yaffle.pepperfish.net ([88.99.213.221] helo=[10.112.101.20]) by ceres.etla.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dRiAq-0007MZ-2Q; Sun, 02 Jul 2017 17:56:40 +0100 X-X-Sender: vivek@platypus.pepperfish.net In-Reply-To: X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam_report: Spam detection software, running on the system "ceres.etla.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > Also, the syntax is very heavy. Was it inspired by another programming > language? The ones I'm familiar with use $1, {1}, or similar syntax, but > I've never seen %1$s :/ From printf(3): By default, the arguments are used in the order given, … One can also specify explicitly which argument is taken, at each place where an argument is required, by writing "%m$" instead of '%' and "*m$" instead of '*', where the decimal integer m denotes the position in the argument list of the desired argument, indexed starting from 1. Thus, [...] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 85.119.82.193 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216116 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-21034188-1499014608=:31053 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT > Also, the syntax is very heavy. Was it inspired by another programming > language? The ones I'm familiar with use $1, {1}, or similar syntax, but > I've never seen %1$s :/ >From printf(3): By default, the arguments are used in the order given, … One can also specify explicitly which argument is taken, at each place where an argument is required, by writing "%m$" instead of '%' and "*m$" instead of '*', where the decimal integer m denotes the position in the argument list of the desired argument, indexed starting from 1. Thus, printf("%*d", width, num); and printf("%2$*1$d", width, num); https://en.wikipedia.org/wiki/Printf_format_string#Parameter_field I don't know when POSIX introduced it, but it's been around for a while. --8323329-21034188-1499014608=:31053--