From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id INKOOOKdVGErCAEAgWs5BA (envelope-from ) for ; Wed, 29 Sep 2021 19:09:54 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6EU0NOKdVGF2ZQAAB5/wlQ (envelope-from ) for ; Wed, 29 Sep 2021 17:09:54 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E0E3FD092 for ; Wed, 29 Sep 2021 19:09:53 +0200 (CEST) Received: from localhost ([::1]:48880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVcVT-0001vV-W9 for larch@yhetil.org; Wed, 29 Sep 2021 12:32:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVcS3-0006da-OH for help-guix@gnu.org; Wed, 29 Sep 2021 12:28:59 -0400 Received: from tobias.gr ([2a02:c205:2020:6054::1]:60034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVcS0-0002hw-Gl for help-guix@gnu.org; Wed, 29 Sep 2021 12:28:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=6leds3WaRZDe1 V4mM2n0plt4MNzBQWr2ev/l9GteMFk=; h=in-reply-to:date:subject:cc:to: from:references; d=tobias.gr; b=BeJa7O3CsDU4t14xjRbo0CbmsPhU2yOuIWh9bg qjLVXLgngKnUNWHt/XFFAwNYjdO0fnouSXmfhdwDI05vZ/pdk2F+bnILEF+l5ToVfWm9fV a8KyxFhu5XZG1ot9kRtcGpQ5DLgF6ebzfsR47I3HvIK5kgM9rJSczm5i3m3djebGvOcFGl Ff2vFYXBigj0gOesGmhAxqQUGEsHpigwkkPls9Jz6TwkTrnvm8/EWGT+/BLyRF6OKttKdN bCK52rgCeTB0ICEIRdBCpdwYIJKLR/PIEzNzzpBUZTvahWQgqND0/N6W2P88mwTTOfqdw+ zNMKBkEuca7X3cHWCbsGHGxw== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 5222098a (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 29 Sep 2021 16:28:49 +0000 (UTC) References: <874ka3zco4.fsf@gmail.com> From: Tobias Geerinckx-Rice To: =?utf-8?Q?Andr=C3=A9_A=2E_Gomes?= Cc: help-guix@gnu.org Subject: Re: Meaning of "~@" in the format procedure Date: Wed, 29 Sep 2021 18:24:57 +0200 In-reply-to: <874ka3zco4.fsf@gmail.com> BIMI-Selector: v=BIMI1; s=default; Message-ID: <87wnmz1h2p.fsf@nckx> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=2a02:c205:2020:6054::1; envelope-from=me@tobias.gr; helo=tobias.gr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632935394; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=6leds3WaRZDe1V4mM2n0plt4MNzBQWr2ev/l9GteMFk=; b=VDAkgwBNs1JdV5gmKNaXyy1dUwUNJySPSDBUgIM6CU+3HKqAbKVj5WOLOBOIXkpPUsGYd+ vfu0ge1fmmA3ZfmkM57oYZFwg0XpoFBmsYvALd5wp1DLVWJkpHcqIIL4EDjGQipL6Iv+v5 ArpqArGLUCwH+RVcz5k6QBQEvBXEveSq00YNFUd2wKXCgjqz1rSY8rW2pAbj+DwHLTX82s wW5+QLPUAgJ66j8nP8DJh36udF9wOgod1CP65vx06BmpDlvSNXTBRxbrEJwHanKBVZron0 t/2OvQzujJVCJBpziHudS6uL247eD311F9EIVUACtmRJF5LVwtZAm825vSw9FA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632935394; a=rsa-sha256; cv=none; b=n+R8d/au78GAWyqnk551SP9XwZCy+4KfG4ALuXEbVdY4b81D1usS3VSLYn8h6y60Q63QH2 hxuhaQ0Dtr8eE+3CWFDgTLQ9YBAgOqnzCXCkD9VTPOf0hYtJ4IynO9WbMjoQeY4KNzU7MY B9j2+3jGxjxGhITO6xl2G/MdjEgMLtO9GE5zPuPPz1gO1C3BHmowT1dsWd8hFBlUqZPibi ZbJMRmYLxLEUPvXgvn1OG6WTBqYgGJLXsPT6u5fHAWOZx/xAdKUHIQfuOzxrUp0vTQ5n91 IuF1fJrBOEeL3Bz5pJ0g2pXrzy+g0UiTMoqKTQGB+9ZSlW+xgKqM5/KkGZfGqg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=tobias.gr header.s=2018 header.b=BeJa7O3C; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Spam-Score: -4.70 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=tobias.gr header.s=2018 header.b=BeJa7O3C; dmarc=pass (policy=reject) header.from=tobias.gr; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: E0E3FD092 X-Spam-Score: -4.70 X-Migadu-Scanner: scn0.migadu.com X-TUID: Bjvwdx1DZlbd --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Andr=C3=A9, Andr=C3=A9 A. Gomes =E5=86=99=E9=81=93=EF=BC=9A > I see that "~@" is used frequently in Guix' codebase in the=20 > format > procedure but I don't understand what it does. (info "(guile) > Formatted Output") didn't help much. For background: ~@ conventionally modifies the=20 behaviour of ~. For example, ~f formats a fixed-point=20 number, and ~@f tweaks it to unconditionally print a + sign on=20 positive numbers. At first glance the =E2=80=98@=E2=80=99 in ~@ looks like a first-class form= at=20 character, but it's really just the same thing: it modifies=20 ~, where is the literal newline that follows ~@=20 in your example. I hope that's clear :-) That's why it's hard to=20 search for. The Guile manual section you read uses the literal strings=20 =E2=80=98~newline=E2=80=99 and =E2=80=98~@newline=E2=80=99 for this. I hop= e re-reading that with=20 this in mind will be more clear. If not, an example is probably=20 worth all of the above words: |(format #t "a~ |b") =3D> ab I.e., the newline is ignored, similar to \ at the end of a line in=20 other languages. This allows writing crazy long output lines=20 without exceeding 80 characters in your text editor. |(format #t "a~ | b") =3D> a b |(format #t "a~@ | b") =3D> ab The @ between ~ and the newline makes Guile ignore all leading=20 whitespace before the b. It looks much better in code than the=20 first format example, but the result is identical. The reason to=20 follow the first or last style is purely cosmetic. In the case of emacs-exwm, we want to generate a .desktop file=20 without leading spaces, without messing up the indentation of the=20 .scm file. > Speaking of that, what does "$@" do after emacs? > emacs "$@" --eval 'a-sexp' This is a completely unrelated @. In shell scripting, and=20 contexts that try to be =E2=80=99shell-like=E2=80=99, "$@" expands to all=20 command-line arguments. They are safely quoted so that one=20 argument that contains whitespace won't get misinterpreted as=20 multiple arguments. Example shell script: #!/bin/sh echo "I was called with these arguments:" "$@" # Now invoke emacs with the same arguments, adding --floop at=20 the end: emacs "$@" --floop Kind regards, T G-R --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYVSUTw0cbWVAdG9iaWFz LmdyAAoJEA2w/4hPVW15Sf8A/3Z/kzr9umRevlhcQk2bnkVWLI0aBxD2uyeF+TJL SMJnAP9AYGKGisAlWuH+h4ckMRg8juL0x7db8ucAb1oP0noZAQ== =nuc5 -----END PGP SIGNATURE----- --=-=-=--