From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Lars Ingebrigtsen <larsi@gnus.org>
Newsgroups: gmane.emacs.devel
Subject: Re: RFC: String interpolation
Date: Wed, 14 Dec 2016 00:55:17 +0100
Message-ID: <m3vaun4c62.fsf@gnus.org>
References: <51825111-ace4-f750-4077-026a3b648d27@gmail.com>
	<8737hwnc52.fsf@lifelogs.com> <m34m2bj2m2.fsf@gnus.org>
	<8c117f5c-209a-97d8-79ce-a78f707f0545@gmail.com>
	<m3wpf7hjzf.fsf@gnus.org>
	<76c9c475-0180-aa49-3d4a-006d4e3f943c@gmail.com>
	<m3oa0ifgvd.fsf@gnus.org> <m2k2b6rxaj.fsf@gmail.com>
	<m38trmdun6.fsf@gnus.org>
	<jwvr35dub31.fsf-monnier+gmane.emacs.devel@gnu.org>
	<m3r35dcwht.fsf@gnus.org>
	<89a6a20d-e135-caad-6b31-760ab7ac90fc@cs.ucla.edu>
	<87fultkjte.fsf@lifelogs.com>
	<3ff9e7e4-aee7-191e-5e3b-4d4ac0006a1f@cs.ucla.edu>
	<9e138d20-782d-2a56-75f8-37e3fa1885df@cs.ucla.edu>
	<E1cGr5w-0000yZ-0w@fencepost.gnu.org>
	<4e9c0a7e-2d44-5fc7-79d8-7b19758fef01@cs.ucla.edu>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: blaine.gmane.org 1481673367 18470 195.159.176.226 (13 Dec 2016 23:56:07 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 13 Dec 2016 23:56:07 +0000 (UTC)
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
Cc: rms@gnu.org, emacs-devel@gnu.org
To: Paul Eggert <eggert@cs.ucla.edu>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 14 00:56:00 2016
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
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 <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1cGwvN-00034u-B6
	for ged-emacs-devel@m.gmane.org; Wed, 14 Dec 2016 00:55:57 +0100
Original-Received: from localhost ([::1]:44672 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1cGwvR-0005Qb-JH
	for ged-emacs-devel@m.gmane.org; Tue, 13 Dec 2016 18:56:01 -0500
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49648)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <larsi@gnus.org>) id 1cGwur-0005EH-7W
	for emacs-devel@gnu.org; Tue, 13 Dec 2016 18:55:26 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <larsi@gnus.org>) id 1cGwuo-0006aM-5g
	for emacs-devel@gnu.org; Tue, 13 Dec 2016 18:55:25 -0500
Original-Received: from hermes.netfonds.no ([80.91.224.195]:42409)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <larsi@gnus.org>)
	id 1cGwun-0006ZT-Vv; Tue, 13 Dec 2016 18:55:22 -0500
Original-Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=stories)
	by hermes.netfonds.no with esmtpsa
	(TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2)
	(envelope-from <larsi@gnus.org>)
	id 1cGwuk-0007vJ-4n; Wed, 14 Dec 2016 00:55:20 +0100
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEUaGRwtLivZ2dr8/PzC
	wr+lpan39/bx8fBPUE/////+//6ysrDo6OGenp9ycnCOjpIHUFehAAAAp0lEQVQ4jWOYiQMw0FBi
	Mi6JaXSwHE1iFi6J6SQZNc2Sqq6insT0L+d9olVj9mi6T3ZCkZjf8YK1MVCU7wnvnMaVKBLhr0V/
	/OhnfC83+cdKSDBAJRrfsTZuFBV40VjEi6JjzpX6TSG5d7y3Lk26SpFzM8nw4HCUmF45jQyjFuOS
	SCNgVJElDonF6ILTcFk+fdZJHHZM1pyOy/LZuCTmM8DKCLR8ZQcAp9molQT2Sn8AAAAASUVORK5C
	YII=
In-Reply-To: <4e9c0a7e-2d44-5fc7-79d8-7b19758fef01@cs.ucla.edu> (Paul Eggert's
	message of "Tue, 13 Dec 2016 10:05:42 -0800")
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 80.91.224.195
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel/>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Original-Sender: "Emacs-devel" <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.devel:210421
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/210421>

Paul Eggert <eggert@cs.ucla.edu> writes:

>       (message (concat "Clock stopped at %s after "
>                        (org-minutes-to-clocksum-string (+ (* 60 h) m))
> "%s")
>                te (if remove " => LINE REMOVED" ""))
>
> could be rewritten this way:
>
>       (message "Clock stopped at %s%" te
>                " after %s%" (org-minutes-to-clocksum-string (+ (* 60 h) m))
>                "%s" (if remove " => LINE REMOVED" ""))

I've been trying out this syntax a bit (just rewriting a few statements
to see whether they look better or worse than the old statements :-)),
and I think I kinda like it.

It seems clean and there's no "magic", so there are no corner cases that
I can see.

The number of ""s may be an impediment against using it in some cases,
though.  If you look at a simple format statement today:

(message "The time is %d in the %s bit of %s" clock part country)

I don't think you'd want to rewrite that to

(message "The time is %d%" clock " in the %s%" part " bit of %s%" country)

Or would you?  (The final "%" is optional, of course.")  It has the
advantage that you don't have to count to match up variables with
formatting statements, but it's not as immediately clear what the
resulting string will end up looking like.

Hm...  

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no