GNU bug report logs - #65902
29.0.92; emacsclient-mail.desktop fails due to complicated escaping

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: sbaugh@HIDDEN; Keywords: patch; dated Wed, 13 Sep 2023 02:25:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 14:58:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 10:58:17 2023
Received: from localhost ([127.0.0.1]:40853 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgnnN-00031B-11
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 10:58:17 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59884)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgnnL-00030w-Hv
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 10:58:16 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgnnA-0004ZC-25; Thu, 14 Sep 2023 10:58:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Wc20DFnnCU4rTRQ366Z7A0qrDFE37wEa1IHFpXN5E1E=; b=mujmOzUM2ZWh
 qa5HwlJRzDvCGbdqYSk12NTDLvu/2g5oMttIiDZWXT3IJoUn5UNshUY39twUR+qO3cMF813XVRjv5
 vl9LabWzJEAXDX2tTQGG+LdzowUbwX4zD70vNtJkWrk2PWJmxf7J7k01wAJKo+vpIS4vrVX+w7jVe
 aRPcpDbTwVEpYHh1JCWcEcAZRaFLUAm9sYM7d5K0yOeTd6F1aaXNLn2h1UVin61XVQ3w8EDMB/cRU
 WOE7woo3pvcpKHBno/Tt5Y+wzd9saTeMC77iL3UhIpJo2STDhxZDMQq6Hw00bhTMeJKp3LmX9fjwN
 4G++Zqs35FBpjORpoPjoVg==;
Date: Thu, 14 Sep 2023 17:57:52 +0300
Message-Id: <83led8ls3z.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@HIDDEN> (message
 from Spencer Baugh on Thu, 14 Sep 2023 14:48:14 +0000 (UTC))
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to 
 complicated escaping
References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, sbaugh@HIDDEN, jporterbugs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Thu, 14 Sep 2023 14:48:14 +0000 (UTC)
> From: Spencer Baugh <sbaugh@HIDDEN>
> Cc: Spencer Baugh <sbaugh@HIDDEN>, jporterbugs@HIDDEN,
> 	65902 <at> debbugs.gnu.org
> 
> Okay, if I do this without making modifications to emacsclient.c or the server protocol, would that be
> more acceptable? The approach I described in another email, with server-eval-args-left, all it adds is
> a new variable.

I cannot find the description of that approach.  What did it say?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 14:48:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 10:48:31 2023
Received: from localhost ([127.0.0.1]:40804 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgndu-0002i5-GI
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 10:48:31 -0400
Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:33586)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-39fe-65902=debbugs.gnu.org@HIDDEN>)
 id 1qgndr-0002gr-9l
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 10:48:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=subject:in-reply-to:from:mime-version:to:cc:content-type:
 content-transfer-encoding:cc:content-type:from:subject:to;
 s=s1; bh=khOLX21PrQSiXDPJGZdV3XVAuqEg+H81BuMT2qCRTS8=;
 b=SB2omD0Uhy8qmsWsuglk0/RpJDFTXY+iJf9sfrrrb8cfvgjL4goYXoGAkrBgEFgJ24Z0
 w7CFMwSxvN2WyO7qn2knHtDsOjtyvmktrlTLYeLT3+CvBS/G6OZGoAPd4v4gkn3QTORvcd
 l1KTHKFdJCLB9N/XW7TzI/eICmEqKg/eYafLr5hK1gpy2PRr7orHQG1gtbVIddLF7BV0Jf
 TjIY+3myXl0MJbbBFKJjvYpFcUwHXJ7rdr6Z7D7c504IjSanCFqNkwjFMrxtwbJMsVKoGB
 G5hpdLTl6T/4TPhxgNJuD82HnBXFf0OPSTpoW/sidgG2A1FXqBIONgaYUQffJoCQ==
Received: by filterdrecv-7765c6879f-vtjd5 with SMTP id
 filterdrecv-7765c6879f-vtjd5-1-65031D2E-10
 2023-09-14 14:48:14.151752224 +0000 UTC m=+3023580.625499194
Received: from earth.catern.com (unknown) by geopod-ismtpd-35 (SG) with ESMTP
 id hmXf9ka8T9CS03i1LPfBig Thu, 14 Sep 2023 14:48:14.047 +0000 (UTC)
Date: Thu, 14 Sep 2023 14:48:14 +0000 (UTC)
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to 
 complicated escaping
Message-ID: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@HIDDEN>
X-Android-Message-ID: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@HIDDEN>
In-Reply-To: <83o7i4ltbz.fsf@HIDDEN>
From: Spencer Baugh <sbaugh@HIDDEN>
Importance: Normal
X-Priority: 3
X-MSMail-Priority: Normal
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?GW3oCMoYnalRiojMOuLzE6x2H5kORXvlCdz1UwQVRMVT4fbh9ODEfCogOe74cO?=
 =?us-ascii?Q?rI4e0V+MFZgakz9Re5a6=2FCgsxWnPSdnvztRlkPg?=
 =?us-ascii?Q?CDG6OSkgPQ2uGpvKgcGrm8zqZF+rSu5im23smQ7?=
 =?us-ascii?Q?3OVFuZvMtdHTAaYH6zlRBS8tGxXemwFsUTjNBwE?=
 =?us-ascii?Q?b8QzwfIp3drCXrmQPmSduuQiP=2FyfoUwkZhWLkAe?=
 =?us-ascii?Q?HP5XNdt6c7Bed=2FK95=2F78m64wG0M1ygoqpBR1T5?=
To: Eli Zaretskii <eliz@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: base64
X-Spam-Score: 4.3 (++++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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:  On Sep 14, 2023 10:31, Eli Zaretskii <eliz@HIDDEN> wrote:
 > From: Spencer Baugh <sbaugh@HIDDEN> > Cc: sbaugh@HIDDEN,
 jporterbugs@HIDDEN, 
 65902 <at> debbugs.gnu.org > Date: Thu, 14 Sep 2023 10:04:48 -0400 > > Eli Zaretskii
 <eliz@HIDDEN> writes: > > [...] 
 Content analysis details:   (4.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [149.72.154.232 listed in wl.mailspike.net]
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
 bl.spamcop.net
 [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.154.232>]
 0.1 MIME_HTML_ONLY         BODY: Message only has text/html MIME parts
 0.0 HTML_MESSAGE           BODY: HTML included in message
 0.0 MIME_BASE64_TEXT       RAW: Message text disguised using base64
 encoding 1.3 RCVD_IN_VALIDITY_RPBL  RBL: Relay in Validity RPBL,
 https://senderscore.org/blocklistlookup/
 [149.72.154.232 listed in bl.score.senderscore.com]
 0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
 lines
 0.6 HTML_MIME_NO_HTML_TAG  HTML-only message, but there is no HTML
 tag
 1.0 MALF_HTML_B64          Malformatted base64-encoded HTML content
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, Spencer Baugh <sbaugh@HIDDEN>,
 jporterbugs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 3.3 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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:  On Sep 14, 2023 10:31, Eli Zaretskii <eliz@HIDDEN> wrote:
    > From: Spencer Baugh <sbaugh@HIDDEN> > Cc: sbaugh@HIDDEN, jporterbugs@HIDDEN,
    65902 <at> debbugs.gnu.org > Date: Thu, 14 Sep 2023 10:04:48 -0400 > > Eli Zaretskii
    <eliz@HIDDEN> writes: > > [...] 
 
 Content analysis details:   (3.3 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [149.72.154.232 listed in wl.mailspike.net]
  1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
                             bl.spamcop.net
              [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.154.232>]
  1.3 RCVD_IN_VALIDITY_RPBL  RBL: Relay in Validity RPBL,
                             https://senderscore.org/blocklistlookup/
                            [149.72.154.232 listed in bl.score.senderscore.com]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.1 MIME_HTML_ONLY         BODY: Message only has text/html MIME parts
  0.0 HTML_MESSAGE           BODY: HTML included in message
  0.0 MIME_BASE64_TEXT       RAW: Message text disguised using base64
                             encoding
  0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
                             lines
  0.6 HTML_MIME_NO_HTML_TAG  HTML-only message, but there is no HTML
                             tag
  1.0 MALF_HTML_B64          Malformatted base64-encoded HTML content
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

PGRpdiBkaXI9J2F1dG8nPjxkaXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPjxkaXYgY2xhc3M9
ImdtYWlsX3F1b3RlIj5PbiBTZXAgMTQsIDIwMjMgMTA6MzEsIEVsaSBaYXJldHNraWkgJmx0O2Vs
aXpAZ251Lm9yZyZndDsgd3JvdGU6PGJyIHR5cGU9ImF0dHJpYnV0aW9uIj48YmxvY2txdW90ZSBj
bGFzcz0icXVvdGUiIHN0eWxlPSJtYXJnaW46MCAwIDAgLjhleDtib3JkZXItbGVmdDoxcHggI2Nj
YyBzb2xpZDtwYWRkaW5nLWxlZnQ6MWV4Ij48cCBkaXI9Imx0ciI+Jmd0OyBGcm9tOiBTcGVuY2Vy
IEJhdWdoICZsdDtzYmF1Z2hAamFuZXN0cmVldC5jb20mZ3Q7Cjxicj4KJmd0OyBDYzogc2JhdWdo
QGNhdGVybi5jb20sJm5ic3A7IGpwb3J0ZXJidWdzQGdtYWlsLmNvbSwmbmJzcDsgNjU5MDJAZGVi
YnVncy5nbnUub3JnCjxicj4KJmd0OyBEYXRlOiBUaHUsIDE0IFNlcCAyMDIzIDEwOjA0OjQ4IC0w
NDAwCjxicj4KJmd0OyAKPGJyPgomZ3Q7IEVsaSBaYXJldHNraWkgJmx0O2VsaXpAZ251Lm9yZyZn
dDsgd3JpdGVzOgo8YnI+CiZndDsgCjxicj4KJmd0OyAmZ3Q7IFdoYXQgeW91IGFyZSBkb2luZyBp
cyByZXByZXNlbnRpbmcgYSByYXJlIHByb2JsZW0gcmVsYXRlZCB0byBhIG5pY2hlCjxicj4KJmd0
OyAmZ3Q7IGZlYXR1cmUgaXMgaWYgaXQgd2VyZSBhIGdlbmVyYWwgb25lLCBieSBpbnZlbnRpbmcg
dXNlIGNhc2VzIHRvIGp1c3RpZnkKPGJyPgomZ3Q7ICZndDsgdGhhdC4mbmJzcDsgQnV0IGlmIHRo
b3NlIHVzZSBjYXNlcyB3ZXJlIGltcG9ydGFudCwgcGVvcGxlIHdvdWxkIGhhdmUgYXNrZWQKPGJy
PgomZ3Q7ICZndDsgZm9yIHRoZW0gbG9uZyBhZ28uJm5ic3A7IFRoZXkgZGlkbid0LiZuYnNwOyBX
aHk/IGJlY2F1c2UgLS1ldmFsIGFscmVhZHkgZXhpc3RzLgo8YnI+CiZndDsgCjxicj4KJmd0OyBO
by4uLiB0aGVzZSBhcmUgcmVhbCB1c2UgY2FzZXMgdGhhdCBJIHBlcnNvbmFsbHkgaGF2ZS4mbmJz
cDsgSSBoYXZlIHJlYWxseQo8YnI+CiZndDsgd2FudGVkIHRoaXMgZm9yIGEgbG9uZyB0aW1lLiZu
YnNwOyBBcyBJIHNhaWQgaW4gbXkgb3JpZ2luYWwgZW1haWwsICJJIGV4cGVjdAo8YnI+CiZndDsg
dGhpcyB0byBhbHNvIGJlIHVzZWZ1bCBpbiBvdGhlciBwbGFjZXM7IHRoZSBuZWVkIHRvIGVzY2Fw
ZSBhcmJpdHJhcnkKPGJyPgomZ3Q7IGlucHV0cyBiZWZvcmUgcGFzc2luZyB0aGVtIHRvIGVtYWNz
Y2xpZW50IGlzIGZyZXF1ZW50bHkgYW5ub3lpbmcuIgo8YnI+Cgo8YnI+Ck1heWJlIGl0J3MgYW5u
b3lpbmcsIGJ1dCBpdCBjYW4gYmUgZG9uZS4mbmJzcDsgQW5kIEVtYWNzIGhhcyB0aGUgc2FtZQo8
YnI+CmZlYXR1cmUsIGJ0dy4KPGJyPgoKPGJyPgomZ3Q7ICZndDsgRW1hY3MgZGV2ZWxvcGVycyBt
YWtlIG1pc3Rha2VzIGV2ZW4gaW4gdGhlIHNpbXBsZSByZWdleHBzIHdlIGhhdmUgaW4KPGJyPgom
Z3Q7ICZndDsgb3VyIGNvZGUuJm5ic3A7IFRoYXQgZG9lc24ndCBtZWFuIHdlIHNob3VsZCBhYmFu
ZG9uIHJlZ2V4cHMuJm5ic3A7IFRoZSBzb2x1dGlvbgo8YnI+CiZndDsgJmd0OyBmb3Igc2VuZGlu
ZyBMaXNwIGZvcm1zIHRvIHRoZSBzZXJ2ZXIgZXhpc3RzLCBhbmQgdGhlIHF1b3RpbmcsIGFsdGhv
dWdoCjxicj4KJmd0OyAmZ3Q7IHRyaWNreSBpbiBzb21lIGNhc2VzLCBpcyBub3Qgcm9ja2V0IHNj
aWVuY2UgdG8gZ2V0IHJpZ2h0Lgo8YnI+CiZndDsgCjxicj4KJmd0OyBJIHRoaW5rIHRoaXMgKHRo
ZSBjdXJyZW50IGNvbnRlbnRzIG9mIGVtYWNzY2xpZW50LW1haWwuZGVza3RvcCk6Cjxicj4KJmd0
OyBzaCAtYyAidT1cXCQoZWNobyBcXCJcXCQxXFwiIHwgc2VkICdzL1tcXFxcXFwiXS9cXFxcXFxc
XCZhbXA7L2cnKTsgZXhlYwo8YnI+CiZndDsgZW1hY3NjbGllbnQgLS1hbHRlcm5hdGUtZWRpdG9y
PSAtLWRpc3BsYXk9XFwiXFwkRElTUExBWVxcIiAtLWV2YWwKPGJyPgomZ3Q7IFxcIihtZXNzYWdl
LW1haWx0byBcXFxcXFwiXFwkdVxcXFxcXCIpXFwiIiBzaCAldQo8YnI+CiZndDsgCjxicj4KJmd0
OyBpcyBpbiBmYWN0IHJvY2tldCBzY2llbmNlLCBhbmQgcm9ja2V0IHNjaWVuY2UgdGhhdCBuZWVk
cyB0byBiZSByZXBlYXRlZAo8YnI+CiZndDsgYnkgZXZlcnkgdXNlciB3aG8gd2FudHMgdG8gcGFz
cyBhcmJpdHJhcnkgc3RyaW5ncyB0byBFbWFjcy4KPGJyPgoKPGJyPgpXZSBkaXNhZ3JlZS4KPGJy
PgoKPGJyPgoKPGJyPgomZ3Q7IEFuZCBrZWVwIGluIG1pbmQgdGhpcyBtYXNzIG9mIGVzY2FwaW5n
ICppcyBjdXJyZW50bHkgYnJva2VuKi4KPGJyPgoKPGJyPgpQYXRjaGVzIHRvIGZpeCBpdCBhcmUg
d2VsY29tZSwgYWx0aG91Z2ggYXMgSSBzYWlkIEknZCBiZSBxdWl0ZSBnbGFkIHRvCjxicj4KcmVt
b3ZlIHRoZXNlIGRlc2t0b3AgZmlsZXMgZnJvbSBvdXIgcmVwb3NpdG9yeS4KPGJyPgoKPGJyPgom
Z3Q7ICZndDsgVGhhdCdzIGFuIGlsbHVzaW9uLiZuYnNwOyBUaGVyZSdzIG5vdGhpbmcgc2ltcGxl
IGFib3V0IGl0LiZuYnNwOyBZb3UgYXJlCjxicj4KJmd0OyAmZ3Q7IGludmVudGluZyBhIG5ldyBt
ZWNoYW5pc20gZm9yIHBhc3NpbmcgTGlzcCBmb3JtcyBhcyBzb21ldGhpbmcgb3RoZXIKPGJyPgom
Z3Q7ICZndDsgdGhhbiBMaXNwLgo8YnI+CiZndDsgCjxicj4KJmd0OyBCdXQgSSBkb24ndCB3YW50
IHRvIHBhc3MgTGlzcCBmb3JtcywgdGhhdCdzIHRoZSBlbnRpcmUgcG9pbnQuJm5ic3A7IEkgaGF2
ZQo8YnI+CiZndDsgc29tZSBhcmJpdHJhcnkgc3RyaW5nIHdoaWNoIGlzICpub3QqIExpc3AsIGFu
ZCBJIHdhbnQgRW1hY3MgdG8gKm5vdCoKPGJyPgomZ3Q7IHBhcnNlIGl0IGFzIExpc3AuCjxicj4K
Cjxicj4KSXQgYmVjb21lcyBMaXNwIHdoZW4gdGhlIHNlcnZlciBleGVjdXRlcyB0aGUgcmVxdWVz
dC4KPGJyPgoKPGJyPgomZ3Q7ICZndDsmbmJzcDsmbmJzcDsgJCBlbWFjc2NsaWVudCAtLWFwcGx5
IGZ1bmMgYXJnMSAnZm9vIGFyZzIgJ2Jhcgo8YnI+CiZndDsgJmd0Owo8YnI+CiZndDsgJmd0OyBF
c2NhcGUtcXVvdGluZywgaGVyZSB3ZSBjb21lIGFnYWluIQo8YnI+CiZndDsgCjxicj4KJmd0OyBU
aGF0IGV4YW1wbGUgd29ya3MgZmluZSB3aXRoIC0tYXBwbHkuJm5ic3A7IFRoZSBjYWxsIGJlY29t
ZXM6Cjxicj4KJmd0OyAoZnVuYyAiYXJnMSIgIidmb28iICJhcmcyIiAiJ2JhciIpCjxicj4KJmd0
OyB3aGljaCBpcyByZWxpYWJsZSBhbmQgZXhwZWN0ZWQuCjxicj4KJmd0OyAKPGJyPgomZ3Q7IE1h
eWJlIHlvdSdyZSByZWZlcnJpbmcgdG8gaG93LCBpZiB5b3UgcnVuIHRoYXQgY29tbWFuZCB0aHJv
dWdoIGEgc2hlbGwsCjxicj4KJmd0OyB0aGUgc2hlbGwgaW50ZXJwcmV0cyB0aGUgc2luZ2xlIHF1
b3RlcyBhcyBjcmVhdGluZyBhIHN0cmluZz8KPGJyPgoKPGJyPgpPZiBjb3Vyc2UsIEkgYW0hCjxi
cj4KCjxicj4KJmd0OyBCdXQgdGhhdCdzIHRoYXQncyBhIHNlcGFyYXRlIGlzc3VlLCBiZWNhdXNl
Ogo8YnI+CiZndDsgCjxicj4KJmd0OyAtIEkgZG9uJ3QgcGxhbiB0byBydW4gYW55IG9mIG15IGNv
bW1hbmRzIHVzaW5nIC0tYXBwbHkgdGhyb3VnaCBhIHNoZWxsCjxicj4KJmd0OyZuYnNwOyZuYnNw
OyAod2hpY2ggbWVhbnMgdGhleSB3aWxsIHJlcXVpcmUgemVybyBlc2NhcGluZyBvciBxdW90aW5n
IHdoYXRzb2V2ZXIpCjxicj4KCjxicj4KVGhpcyBmZWF0dXJlLCBpZiBpdCB3aWxsIGJlIGFkZGVk
LCBpcyBub3QganVzdCBmb3IgeW91LCBpdCdzIGZvcgo8YnI+CmV2ZXJ5b25lLiZuYnNwOyBBbmQg
ZW1hY3NjbGllbnQgaXMgYSBzaGVsbCBjb21tYW5kLCBzbyBpbnZva2luZyBpdCBmcm9tIHRoZQo8
YnI+CnNoZWxsIGlzIGJvdGggbmF0dXJhbCBhbmQgZnJlcXVlbnRseSB1c2VkLgo8YnI+Cgo8YnI+
CiZndDsgLSBSaWdodCBub3cgd2l0aCAtLWV2YWwgeW91IGhhdmUgdG8gZG8gZXNjYXBpbmcgZm9y
IGJvdGggdGhlIHNoZWxsIGFuZAo8YnI+CiZndDsmbmJzcDsmbmJzcDsgTGlzcC4mbmJzcDsgV2l0
aCAtLWFwcGx5IHlvdSBvbmx5IGhhdmUgdG8gZG8gZXNjYXBpbmcgZm9yIHRoZSBzaGVsbCwgaWYg
eW91Cjxicj4KJmd0OyZuYnNwOyZuYnNwOyBkbyB1c2UgYSBzaGVsbCwgYW5kIGlmIHlvdSBkb24n
dCB1c2UgYSBzaGVsbCB5b3UgZG9uJ3QgaGF2ZSB0byBkbwo8YnI+CiZndDsmbmJzcDsmbmJzcDsg
YW55dGhpbmcuCjxicj4KCjxicj4KQnV0IHdlIGRvIHRoYXQgZm9yIEVtYWNzLCBhbmQgZG8gaXQg
cXVpdGUgYSBsb3QuCjxicj4KCjxicj4KJmd0OyBJIHRoaW5rIGl0IGlzIHNpbXBsZXIgdG8gcmVk
dWNlIHRoZSBhbW91bnQgb2YgcXVvdGluZyBhbmQgZXNjYXBpbmcgZnJvbQo8YnI+CiZndDsgImJv
dGggTGlzcCBhbmQgc2hlbGwiIHRvICJqdXN0IHNoZWxsLCBhbmQgbm90IGV2ZW4gdGhhdCBpZiB5
b3UgZG9uJ3QgdXNlCjxicj4KJmd0OyBhIHNoZWxsIi4KPGJyPgoKPGJyPgpBdCB3aGF0IGNvc3Q/
Jm5ic3A7IFRoZSBjb3N0IG9mIGFkZGluZyB5ZXQgYW5vdGhlciBwcm90b2NvbCBmb3IgcGFzc2lu
Zwo8YnI+Ckxpc3AgZm9ybXMgdG8gdGhlIHNlcnZlciBpcyBqdXN0IHRvbyBoaWdoIGZvciBteSBw
YWxhdGUuPGJyPjwvcD48L2Jsb2NrcXVvdGU+PC9kaXY+PC9kaXY+PC9kaXY+PGRpdiBkaXI9ImF1
dG8iPk9rYXksIGlmIEkgZG8gdGhpcyB3aXRob3V0IG1ha2luZyBtb2RpZmljYXRpb25zIHRvIGVt
YWNzY2xpZW50LmMgb3IgdGhlIHNlcnZlciBwcm90b2NvbCwgd291bGQgdGhhdCBiZSBtb3JlIGFj
Y2VwdGFibGU/IFRoZSBhcHByb2FjaCBJIGRlc2NyaWJlZCBpbiBhbm90aGVyIGVtYWlsLCB3aXRo
IHNlcnZlci1ldmFsLWFyZ3MtbGVmdCwgYWxsIGl0IGFkZHMgaXMgYSBuZXcgdmFyaWFibGUuPC9k
aXY+PGRpdiBkaXI9ImF1dG8iPjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIj48ZGl2IGNsYXNzPSJn
bWFpbF9xdW90ZSI+PGJsb2NrcXVvdGUgY2xhc3M9InF1b3RlIiBzdHlsZT0ibWFyZ2luOjAgMCAw
IC44ZXg7Ym9yZGVyLWxlZnQ6MXB4ICNjY2Mgc29saWQ7cGFkZGluZy1sZWZ0OjFleCI+PHAgZGly
PSJsdHIiPgo8L3A+CjwvYmxvY2txdW90ZT48L2Rpdj48YnI+PC9kaXY+PC9kaXY+PC9kaXY+




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 14:31:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 10:31:57 2023
Received: from localhost ([127.0.0.1]:40763 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgnNs-0002Ep-J2
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 10:31:57 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47314)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgnNr-0002Ec-2V
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 10:31:56 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgnNf-0007UI-5o; Thu, 14 Sep 2023 10:31:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=8wOmVQfDiz5idwfBZgJ8AnZOuMBBZUq5xKd+iPNFJ6E=; b=juMt/HHuXlpN
 jlAytLpntPrVv8FZVFuZr+xhD5xqPMoQqbqs5gIrhguJVL4uhx4bLgfIRRXX8JVewOvDiJF/hut29
 HEdD6rPiiWHdTyZwktxDxP0zLBhB3whL1GFsT6S6n6Qk72GgudiuOfNIfTZ98j/aiAHzoEuas465M
 X7Xbvbne4fLR002mvlA9n4ON0hLLhCF9CfKOTpTOtcsgoe64vWcxc0mytGb9OhZ+HFZ0pDuk2wj44
 2kNyOs06xCYgb0G0n9WoL7/GTvQU5+iilEq4cB3FVQb0Qlqb/VfyXtd7xaJraxVl+NwE2dgv0Dat3
 8DBztjrkOvvkam6LC0VA9A==;
Date: Thu, 14 Sep 2023 17:31:28 +0300
Message-Id: <83o7i4ltbz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <iermsxoam0v.fsf@HIDDEN> (message from Spencer Baugh on
 Thu, 14 Sep 2023 10:04:48 -0400)
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN>
 <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
 <83edj1mja5.fsf@HIDDEN> <87il8dt3sh.fsf@HIDDEN>
 <83pm2klvw9.fsf@HIDDEN> <iermsxoam0v.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, sbaugh@HIDDEN, jporterbugs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Spencer Baugh <sbaugh@HIDDEN>
> Cc: sbaugh@HIDDEN,  jporterbugs@HIDDEN,  65902 <at> debbugs.gnu.org
> Date: Thu, 14 Sep 2023 10:04:48 -0400
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > What you are doing is representing a rare problem related to a niche
> > feature is if it were a general one, by inventing use cases to justify
> > that.  But if those use cases were important, people would have asked
> > for them long ago.  They didn't.  Why? because --eval already exists.
> 
> No... these are real use cases that I personally have.  I have really
> wanted this for a long time.  As I said in my original email, "I expect
> this to also be useful in other places; the need to escape arbitrary
> inputs before passing them to emacsclient is frequently annoying."

Maybe it's annoying, but it can be done.  And Emacs has the same
feature, btw.

> > Emacs developers make mistakes even in the simple regexps we have in
> > our code.  That doesn't mean we should abandon regexps.  The solution
> > for sending Lisp forms to the server exists, and the quoting, although
> > tricky in some cases, is not rocket science to get right.
> 
> I think this (the current contents of emacsclient-mail.desktop):
> sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec
> emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval
> \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u
> 
> is in fact rocket science, and rocket science that needs to be repeated
> by every user who wants to pass arbitrary strings to Emacs.

We disagree.


> And keep in mind this mass of escaping *is currently broken*.

Patches to fix it are welcome, although as I said I'd be quite glad to
remove these desktop files from our repository.

> > That's an illusion.  There's nothing simple about it.  You are
> > inventing a new mechanism for passing Lisp forms as something other
> > than Lisp.
> 
> But I don't want to pass Lisp forms, that's the entire point.  I have
> some arbitrary string which is *not* Lisp, and I want Emacs to *not*
> parse it as Lisp.

It becomes Lisp when the server executes the request.

> >   $ emacsclient --apply func arg1 'foo arg2 'bar
> >
> > Escape-quoting, here we come again!
> 
> That example works fine with --apply.  The call becomes:
> (func "arg1" "'foo" "arg2" "'bar")
> which is reliable and expected.
> 
> Maybe you're referring to how, if you run that command through a shell,
> the shell interprets the single quotes as creating a string?

Of course, I am!

> But that's that's a separate issue, because:
> 
> - I don't plan to run any of my commands using --apply through a shell
>   (which means they will require zero escaping or quoting whatsoever)

This feature, if it will be added, is not just for you, it's for
everyone.  And emacsclient is a shell command, so invoking it from the
shell is both natural and frequently used.

> - Right now with --eval you have to do escaping for both the shell and
>   Lisp.  With --apply you only have to do escaping for the shell, if you
>   do use a shell, and if you don't use a shell you don't have to do
>   anything.

But we do that for Emacs, and do it quite a lot.

> I think it is simpler to reduce the amount of quoting and escaping from
> "both Lisp and shell" to "just shell, and not even that if you don't use
> a shell".

At what cost?  The cost of adding yet another protocol for passing
Lisp forms to the server is just too high for my palate.

Bottom line: the escaping issue doesn't seem to me a reason strong
enough to justify adding such a new feature.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 14:05:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 10:05:03 2023
Received: from localhost ([127.0.0.1]:40684 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgmxr-0007KJ-1Q
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 10:05:03 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:58635)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qgmxo-0007Jk-3M
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 10:05:01 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <83pm2klvw9.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 14 Sep
 2023 16:36:06 +0300")
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN>
 <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
 <83edj1mja5.fsf@HIDDEN> <87il8dt3sh.fsf@HIDDEN>
 <83pm2klvw9.fsf@HIDDEN>
Date: Thu, 14 Sep 2023 10:04:48 -0400
Message-ID: <iermsxoam0v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, sbaugh@HIDDEN, jporterbugs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: sbaugh@HIDDEN
>> Date: Thu, 14 Sep 2023 11:03:44 +0000 (UTC)
>> Cc: Jim Porter <jporterbugs@HIDDEN>, 65902 <at> debbugs.gnu.org,
>> 	sbaugh@HIDDEN
>> 
>> The issue is not really with the desktop file.  It's a generic problem:
>
> No, it isn't.  If it were, we'd have heard about it much sooner, and
> not because of the desktop files.
>
> What you are doing is representing a rare problem related to a niche
> feature is if it were a general one, by inventing use cases to justify
> that.  But if those use cases were important, people would have asked
> for them long ago.  They didn't.  Why? because --eval already exists.

No... these are real use cases that I personally have.  I have really
wanted this for a long time.  As I said in my original email, "I expect
this to also be useful in other places; the need to escape arbitrary
inputs before passing them to emacsclient is frequently annoying."

- I've wanted the ability to pass arbitrary data to Emacs through
  emacsclient since at least 2016, for other reasons:
  https://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00051.html

- The fact that there is currently advice in org-protocol to implement
  this behavior means there are people who want it.  I'm sure the
  org-protocol authors really wanted to be able to avoid that advice,
  back when they developed it in 2009.  They didn't bother contributing
  a solution upstream back then, but why stop it from happening now?

- It would allow lazy loading of org-protocol as desired by the org devs
  https://list.orgmode.org/strc07$3o0$1@HIDDEN

- I'm working on a package which allows using Emacs to do
  completing-read over arbitrary strings passed in from the command
  line, as a replacement for the popular terminal software fzf.  Since
  this is completion over arbitrary strings, I need the ability to get
  those arbitrary strings into Emacs.

- There are numerous examples on the web of users trying and failing to
  get the quoting right to pass arguments to emacsclient; for example

  https://www.reddit.com/r/emacs/comments/hhbcg7/emacsclient_eval_with_command_line_arguments/
  this would become
  emacsclient --apply switch-to-buffer

  https://stackoverflow.com/questions/8848819/emacs-eval-ediff-1-2-how-to-put-this-line-in-to-shell-script
  this would become
  emacsclient --apply ediff

  No shell complexities required in either case.

>> > What about alternative solutions: use a shell script in the desktop
>> > files, and delegate to that script to solve the problem with quoting?
>> > Had anyone considered this strategy?  If not, why not?
>> 
>> Getting the quoting right is hard and complex, and even Emacs developers
>> have failed at it over multiple iterations, and when they fail it either
>> breaks or exposes a security vulnerability.
>
> Emacs developers make mistakes even in the simple regexps we have in
> our code.  That doesn't mean we should abandon regexps.  The solution
> for sending Lisp forms to the server exists, and the quoting, although
> tricky in some cases, is not rocket science to get right.

I think this (the current contents of emacsclient-mail.desktop):
sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec
emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval
\\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u

is in fact rocket science, and rocket science that needs to be repeated
by every user who wants to pass arbitrary strings to Emacs.

And keep in mind this mass of escaping *is currently broken*.

> I don't see
> why we would need another mechanism to do something similar with
> radically different syntax, a separate set of rules and restrictions
> that need to be documented, etc. etc.
>
>> This solution is far simpler
>
> That's an illusion.  There's nothing simple about it.  You are
> inventing a new mechanism for passing Lisp forms as something other
> than Lisp.

But I don't want to pass Lisp forms, that's the entire point.  I have
some arbitrary string which is *not* Lisp, and I want Emacs to *not*
parse it as Lisp.

> This has got to have issues into which we will bump sooner
> or later.  E.g., assume that two or more of the arguments to the
> function begins with single quote, as in
>
>   $ emacsclient --apply func arg1 'foo arg2 'bar
>
> Escape-quoting, here we come again!

That example works fine with --apply.  The call becomes:
(func "arg1" "'foo" "arg2" "'bar")
which is reliable and expected.

Maybe you're referring to how, if you run that command through a shell,
the shell interprets the single quotes as creating a string?  But that's
that's a separate issue, because:

- I don't plan to run any of my commands using --apply through a shell
  (which means they will require zero escaping or quoting whatsoever)

- Right now with --eval you have to do escaping for both the shell and
  Lisp.  With --apply you only have to do escaping for the shell, if you
  do use a shell, and if you don't use a shell you don't have to do
  anything.

I think it is simpler to reduce the amount of quoting and escaping from
"both Lisp and shell" to "just shell, and not even that if you don't use
a shell".




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 13:36:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 09:36:56 2023
Received: from localhost ([127.0.0.1]:37993 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgmWe-0005uT-7l
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 09:36:56 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39564)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgmWZ-0005uD-Dz
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 09:36:55 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgmWM-0004fY-Kd; Thu, 14 Sep 2023 09:36:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=EGvyrUjSTL0VHyHjQfsOuXbdgAfq6ILkvKI9VD9Iqyo=; b=qCsv8WDMCxEI
 xGX6riJrQ+2jzdoT5zR1pwzW5ZIQLF7TZ5Npyqn8c7eBWCXZJd0Bb19Dx/3R4ebxdr5rQRlq5zPpr
 trwb0DbKQXVWutLflnCBaGPTpFgq5lk7zawSor+tkgKsjFjquLwsoRMG/ZnudkCV8rz6tFWAxS5cj
 2pK2bRTOjg2zpcLS/VeA7tt1HSmQPCg6sGQ8a/811Ns56c1jMUKynHEqt4kzbAXHxNJ21WsNbJ3/p
 SSCGlK6/4mVh3At8+pgfPkwNH2pu22mS5uIK//rBJPGR9tAjHccTj0kvO+KSs1E7rX8PYH7FqusBd
 4jCc/iOrUo//4QI/LadEVQ==;
Date: Thu, 14 Sep 2023 16:36:06 +0300
Message-Id: <83pm2klvw9.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: sbaugh@HIDDEN
In-Reply-To: <87il8dt3sh.fsf@HIDDEN> (sbaugh@HIDDEN)
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN>
 <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
 <83edj1mja5.fsf@HIDDEN> <87il8dt3sh.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: jporterbugs@HIDDEN, sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: sbaugh@HIDDEN
> Date: Thu, 14 Sep 2023 11:03:44 +0000 (UTC)
> Cc: Jim Porter <jporterbugs@HIDDEN>, 65902 <at> debbugs.gnu.org,
> 	sbaugh@HIDDEN
> 
> The issue is not really with the desktop file.  It's a generic problem:

No, it isn't.  If it were, we'd have heard about it much sooner, and
not because of the desktop files.

What you are doing is representing a rare problem related to a niche
feature is if it were a general one, by inventing use cases to justify
that.  But if those use cases were important, people would have asked
for them long ago.  They didn't.  Why? because --eval already exists.

> > What about alternative solutions: use a shell script in the desktop
> > files, and delegate to that script to solve the problem with quoting?
> > Had anyone considered this strategy?  If not, why not?
> 
> Getting the quoting right is hard and complex, and even Emacs developers
> have failed at it over multiple iterations, and when they fail it either
> breaks or exposes a security vulnerability.

Emacs developers make mistakes even in the simple regexps we have in
our code.  That doesn't mean we should abandon regexps.  The solution
for sending Lisp forms to the server exists, and the quoting, although
tricky in some cases, is not rocket science to get right.  I don't see
why we would need another mechanism to do something similar with
radically different syntax, a separate set of rules and restrictions
that need to be documented, etc. etc.

> This solution is far simpler

That's an illusion.  There's nothing simple about it.  You are
inventing a new mechanism for passing Lisp forms as something other
than Lisp.  This has got to have issues into which we will bump sooner
or later.  E.g., assume that two or more of the arguments to the
function begins with single quote, as in

  $ emacsclient --apply func arg1 'foo arg2 'bar

Escape-quoting, here we come again!




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 11:35:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 07:35:41 2023
Received: from localhost ([127.0.0.1]:37844 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgkdJ-0000BX-Ce
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 07:35:41 -0400
Received: from s.wfbtzhsw.outbound-mail.sendgrid.net ([159.183.224.105]:40538)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-39fe-65902=debbugs.gnu.org@HIDDEN>)
 id 1qgkdF-0000BH-Oo
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 07:35:40 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:in-reply-to:references:mime-version:to:cc:content-type:
 content-transfer-encoding:cc:content-type:from:subject:to;
 s=s1; bh=L7wDdi2vczeThzdk5D/eQxsy4xDd3iKUH0ezmqWzt9A=;
 b=hfBTa0kFmNl7v+23xp9yOFNG4LAEScgLr2jFsRgP+tIbBp67IVMLLyLs7nqV2VOgp73Y
 YuNrAaqlyUu4PjDJikJ7pS1HxiDE7rTNflANKZOGCfpooESzmK1KkON+zLrFBBact4POko
 8/7l5j9OozWIMEDcVk3+ShGjKaNnf2OTn6e2prHdgW0+OD/RAS34ewcA9v1OB4/Yga2qSi
 q7PLxT2Fw6Bdd4Afd+/bzy4u3M5tQa36nD3vhTcQLf9in6vGoaTOzUwHUh7msaRWYcuHIk
 YJfneqGV3nSVaCZB/cEie5uWzU9DQVQipQDNGdR3ZO4DN67/MKvzYUTSmnwsF2Pg==
Received: by filterdrecv-84b96456cb-b9h64 with SMTP id
 filterdrecv-84b96456cb-b9h64-1-6502EFFC-4F
 2023-09-14 11:35:24.918209162 +0000 UTC m=+3867150.254278078
Received: from earth.catern.com (unknown) by geopod-ismtpd-12 (SG) with ESMTP
 id qF8skRtNSbCDGnc6GuFNeQ Thu, 14 Sep 2023 11:35:24.583 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=gnu.org 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id 1A0A360129;
 Thu, 14 Sep 2023 07:35:24 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <87il8dt3sh.fsf@HIDDEN> (sbaugh@HIDDEN's message of "Thu, 
 14 Sep 2023 11:03:44 +0000 (UTC)")
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN>
 <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
 <83edj1mja5.fsf@HIDDEN> <87il8dt3sh.fsf@HIDDEN>
Date: Thu, 14 Sep 2023 11:35:24 +0000 (UTC)
Message-ID: <87a5tpt2bo.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJMDlYe6YMWlSeLtU4L7O?=
 =?us-ascii?Q?BKbcfQPBu4ptfh+7c8hKtnpX=2FscgTHVfJ+w7G+E?=
 =?us-ascii?Q?m242VIUm6fpYaN9VGXwZyPxHK3ZVuQOANv4hMAW?=
 =?us-ascii?Q?hKl4OPfLhhUStUESeATo66kSasa2yQp27RSmNmb?=
 =?us-ascii?Q?cX9IeEOwJ3e6XBO+aElFXSePVdJKJIz2iJA=3D=3D?=
To: Eli Zaretskii <eliz@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, Jim Porter <jporterbugs@HIDDEN>,
 sbaugh@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

sbaugh@HIDDEN writes:
> - Finally, a fourth approach is to teach emacsclient to be able to send
>   this arbitrary data to Emacs on its own.  Such as by adding --apply.
>   There are a bunch of designs for that, but all of them require
>   modifying emacsclient.

BTW, if this specific approach of --apply seems inelegant to you, I
could make a different design work.  As long as Lisp code gets direct
access to the arguments as strings, without needing escaping.

One person in the previous thread proposed making a
command-line-args-left equivalent for emacsclient.  If we did this, it
wouldn't require adding any new arguments to the emacsclient interface.

This could be called server-eval-args-left, so that --apply could be
done instead as:

emacsclient --eval
'(progn (apply func server-eval-args-left) (setq server-eval-args-left nil))'
arg1 arg2

I can do that if you prefer that, but it will require some more
significant changes to the internals (because currently server.el
processes -eval commands one at a time and doesn't have access to the
subsequent ones).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 11:18:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 07:18:30 2023
Received: from localhost ([127.0.0.1]:37828 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgkMf-0005Z3-DD
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 07:18:30 -0400
Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]:22236)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-39fe-65902=debbugs.gnu.org@HIDDEN>)
 id 1qgkMa-0005Ym-EY
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 07:18:27 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:in-reply-to:references:mime-version:to:cc:content-type:
 cc:content-type:from:subject:to;
 s=s1; bh=VW/UV2g9DzSt763rbHdI0QwrZHDDIGVyGo6eN5I+p8E=;
 b=ngOvkqOiTriBjnq2scW3Br2d4AqnEBO6jH3CtxvSYv8KkAY2D5wmir7MOb/fTH77Y7XD
 xbHk+8J7wTezEM9XnYzHVojVPgdv8ZuTD286xtLJxUCL63Fd1ugj7yoFitG8pbatzHNoTb
 6nCX1lnhGfTn1yTNzZl43ZeAtkcqOWEbgQNB7SW5u6xQjKELMZXy6ux4smV41PRMiyvYy7
 GyRJAXxq3BhPVUKLiqKRyuF7tpkCJdz6ltY9VWukQcAFysdFwnKzNvhu6y55nCTr+mC4Cs
 OVvktwfUlvVRfgQyTU6hkvgV0jaehcHxNUGNSCsc9eeB4QLGTI8wApcLg+FTmM8A==
Received: by filterdrecv-d7bbbc8bf-b8xkx with SMTP id
 filterdrecv-d7bbbc8bf-b8xkx-1-6502EBF4-1D
 2023-09-14 11:18:12.954633677 +0000 UTC m=+10928306.467982787
Received: from earth.catern.com (unknown) by geopod-ismtpd-8 (SG) with ESMTP
 id KZBwylntSfOfKyy8ktfmBw Thu, 14 Sep 2023 11:18:12.807 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=gnu.org 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id 3C76B60129;
 Thu, 14 Sep 2023 07:18:12 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <87il8dt3sh.fsf@HIDDEN> (sbaugh@HIDDEN's message of "Thu, 
 14 Sep 2023 11:03:44 +0000 (UTC)")
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN>
 <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
 <83edj1mja5.fsf@HIDDEN> <87il8dt3sh.fsf@HIDDEN>
Date: Thu, 14 Sep 2023 11:18:13 +0000 (UTC)
Message-ID: <87edj1t34b.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJZGaI4O8qNQ4TgjNkgKQ?=
 =?us-ascii?Q?BtPLyhyhmLAJUHmm8ZUshkasbKFJ2tGwjGJVwOD?=
 =?us-ascii?Q?dehFfuxzxFk9gkOQc08uLBFVT44sp5cn+5PFiS3?=
 =?us-ascii?Q?7btt9H+JJ4QiFBVcRy7elBUJoOyV2y6IqAVZ96Q?=
 =?us-ascii?Q?a+3SXhgamLqi9kWsGxtrz82abX9kuvGamKg=3D=3D?=
To: Eli Zaretskii <eliz@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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:  Here's a revised patch which drops adding the argument to
 Emacs itself; it only adds an argument to emacsclient. From
 d4558462598eaa33466b3b2fb1dbcc26ea877ede
 Mon Sep 17 00:00:00 2001 From: Spencer Baugh <sbaugh@HIDDEN> Date: Thu,
 14 Sep 2023 07:12:22 -0400 Subject: [PATCH] Add --apply argument to emacsclien
 [...] Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
 bl.spamcop.net
 [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.126.143>]
 0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
 lines
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, Jim Porter <jporterbugs@HIDDEN>,
 sbaugh@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

--=-=-=
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Here's a revised patch which drops adding the argument to Emacs itself;
it only adds an argument to emacsclient.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Add-apply-argument-to-emacsclient-to-avoid-escaping.patch

From d4558462598eaa33466b3b2fb1dbcc26ea877ede Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Thu, 14 Sep 2023 07:12:22 -0400
Subject: [PATCH] Add --apply argument to emacsclient to avoid escaping

Passing arguments to functions through emacsclient --eval requires
complicated escaping (as seen in emacsclient-mail.desktop before this
change).

The new --apply argument for emacsclient passes command line arguments
as uninterpreted strings to the specified function.  This simplifies
use cases where arbitrary input needs to be passed to Emacs.

org-protocol will be able to use this as well, which will allow it to
eventually drop its current advice on server-visit-files.

* etc/emacsclient-mail.desktop: Use --apply. (bug#65902)
* lib-src/emacsclient.c (longopts, decode_options, main): Add support
for --apply.
* lisp/server.el (server-apply-and-print): Add.
(server-process-filter): Add support for -apply and -applyargs
---
 etc/emacsclient-mail.desktop |  7 ++-----
 lib-src/emacsclient.c        | 36 ++++++++++++++++++++++++++++++++++--
 lisp/server.el               | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 7 deletions(-)

diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop
index 0a2420ddead..ea0690bacd9 100644
--- a/etc/emacsclient-mail.desktop
+++ b/etc/emacsclient-mail.desktop
@@ -1,10 +1,7 @@
 [Desktop Entry]
 Categories=Network;Email;
 Comment=GNU Emacs is an extensible, customizable text editor - and more
-# We want to pass the following commands to the shell wrapper:
-# u=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")"
-# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'.
-Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u
+Exec=emacsclient --alternate-editor= --apply message-mailto -- %u
 Icon=emacs
 Name=Emacs (Mail, Client)
 MimeType=x-scheme-handler/mailto;
@@ -16,7 +13,7 @@ Actions=new-window;new-instance;
 
 [Desktop Action new-window]
 Name=New Window
-Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u
+Exec=emacsclient --alternate-editor= --create-frame --apply message-mailto -- %u
 
 [Desktop Action new-instance]
 Name=New Instance
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 698bf9b50ae..159c22d1ae9 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -116,6 +116,9 @@ #define DEFAULT_TIMEOUT (30)
 /* True means args are expressions to be evaluated.  --eval.  */
 static bool eval;
 
+/* The function to call.  Other arguments are passed as strings.  --apply.  */
+static char *apply;
+
 /* True means open a new frame.  --create-frame etc.  */
 static bool create_frame;
 
@@ -169,6 +172,7 @@ #define DEFAULT_TIMEOUT (30)
   { "quiet",	no_argument,	   NULL, 'q' },
   { "suppress-output", no_argument, NULL, 'u' },
   { "eval",	no_argument,	   NULL, 'e' },
+  { "apply",	required_argument, NULL, 'y' },
   { "help",	no_argument,	   NULL, 'H' },
   { "version",	no_argument,	   NULL, 'V' },
   { "tty",	no_argument,       NULL, 't' },
@@ -552,6 +556,10 @@ decode_options (int argc, char **argv)
 	  eval = true;
 	  break;
 
+	case 'y':
+	  apply = optarg;
+	  break;
+
 	case 'q':
 	  quiet = true;
 	  break;
@@ -690,6 +698,7 @@ print_help_and_exit (void)
 -F ALIST, --frame-parameters=ALIST\n\
 			Set the parameters of a new frame\n\
 -e, --eval    		Evaluate the FILE arguments as ELisp expressions\n\
+-y, --apply FUNC	Call ELisp FUNC, passing all FILE arguments as strings\n\
 -n, --no-wait		Don't wait for the server to return\n\
 -w, --timeout=SECONDS	Seconds to wait before timing out\n\
 -q, --quiet		Don't display messages on success\n\
@@ -1953,7 +1962,7 @@ main (int argc, char **argv)
   /* Process options.  */
   decode_options (argc, argv);
 
-  if (! (optind < argc || eval || create_frame))
+  if (! (optind < argc || eval || apply || create_frame))
     {
       message (true, ("%s: file name or argument required\n"
 		      "Try '%s --help' for more information\n"),
@@ -1961,6 +1970,14 @@ main (int argc, char **argv)
       exit (EXIT_FAILURE);
     }
 
+  if (eval && apply)
+    {
+      message (true, ("%s: can't pass both --eval and --apply\n"
+		      "Try '%s --help' for more information\n"),
+	       progname, progname);
+      exit (EXIT_FAILURE);
+    }
+
 #ifdef SOCKETS_IN_FILE_SYSTEM
   if (tty)
     {
@@ -2080,6 +2097,13 @@ main (int argc, char **argv)
               send_to_emacs (emacs_socket, " ");
               continue;
             }
+	  else if (apply)
+	    {
+              send_to_emacs (emacs_socket, "-applyarg ");
+              quote_argument (emacs_socket, argv[i]);
+              send_to_emacs (emacs_socket, " ");
+              continue;
+	    }
 
 	  char *p = argv[i];
 	  if (*p == '+')
@@ -2136,10 +2160,18 @@ main (int argc, char **argv)
       send_to_emacs (emacs_socket, " ");
     }
 
+  if (apply)
+    {
+      send_to_emacs (emacs_socket, "-apply ");
+      quote_argument (emacs_socket, apply);
+      send_to_emacs (emacs_socket, " ");
+    }
+
+
   send_to_emacs (emacs_socket, "\n");
 
   /* Wait for an answer. */
-  if (!eval && !tty && !nowait && !quiet && 0 <= process_grouping ())
+  if (!eval && !apply && !tty && !nowait && !quiet && 0 <= process_grouping ())
     {
       printf ("Waiting for Emacs...");
       skiplf = false;
diff --git a/lisp/server.el b/lisp/server.el
index c3325e5a24c..5981e90625d 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -873,6 +873,17 @@ server-eval-and-print
                        (point-min) (point-max))))
             (server-reply-print (server-quote-arg text) proc)))))))
 
+(defun server-apply-and-print (func args proc)
+  "Call FUNC on ARGS and send the result back to client PROC."
+  (let ((v (with-local-quit (eval (apply (intern func) args) t))))
+    (when proc
+      (with-temp-buffer
+        (let ((standard-output (current-buffer)))
+          (pp v)
+          (let ((text (buffer-substring-no-properties
+                       (point-min) (point-max))))
+            (server-reply-print (server-quote-arg text) proc)))))))
+
 (defconst server-msg-size 1024
   "Maximum size of a message sent to a client.")
 
@@ -1196,6 +1207,7 @@ server-process-filter
 		tty-type   ; string.
 		files
 		filepos
+		applyargs
 		args-left)
 	    ;; Remove this line from STRING.
 	    (setq string (substring string (match-end 0)))
@@ -1323,6 +1335,28 @@ server-process-filter
                          commands)
                    (setq filepos nil)))
 
+                ;; -apply FUNC:  Call a function on arguments.
+                ("-apply"
+                 (if use-current-frame
+                     (setq use-current-frame 'always))
+                 (let ((func (pop args-left)))
+                   (if coding-system
+                       (setq func (decode-coding-string func coding-system)))
+                   (push (lambda () (server-apply-and-print func applyargs proc))
+                         commands)
+                   (setq applyargs nil)
+                   (setq filepos nil)))
+
+                ;; -applyarg ARG:  Add an argument for later -apply.
+                ("-applyarg"
+                 (if use-current-frame
+                     (setq use-current-frame 'always))
+                 (let ((arg (pop args-left)))
+                   (if coding-system
+                       (setq arg (decode-coding-string arg coding-system)))
+                   (push arg applyargs)
+                   (setq filepos nil)))
+
                 ;; -env NAME=VALUE:  An environment variable.
                 ("-env"
                  (let ((var (pop args-left)))
-- 
2.41.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 11:04:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 07:04:04 2023
Received: from localhost ([127.0.0.1]:37802 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgk8e-0005Dv-Ho
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 07:04:04 -0400
Received: from s.wfbtzhsw.outbound-mail.sendgrid.net ([159.183.224.105]:58788)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-39fe-65902=debbugs.gnu.org@HIDDEN>)
 id 1qgk8b-0005Dg-1y
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 07:03:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:in-reply-to:references:mime-version:to:cc:content-type:
 content-transfer-encoding:cc:content-type:from:subject:to;
 s=s1; bh=MMnER4WM7dnXJgyHkY+X3lFDYF0U24d2qdrXMdVSwtY=;
 b=ukLZIifqYcfpG1kXwCW456QXkubEJcKhU5QgSDfSZ5fXFyS40x8YOVs2u7YOKJoMvfk4
 0xy3MKu3s+1ZuCs1TkdYc2owkSl3a7Da9gGm6984stBXL6BYGZjBLQrHkaQ+Hax9N5SPxJ
 xPLPei98bsvld5TYmmwiyxtJwy5/QL2bHKk4rJoEpyNXu11dAbtBqlyonPj1XC8CDBLveG
 butM2P5CCzQ6nrA09K6DymlhgRNdBie0uPLfjkH+BfdnMhpYWTx7iPH6pK94Im3ypCyAFn
 ks9b9zTl2VqNP1lEsBkW5bsX6BSPok0rvWwA8Th/cR1kqxuSCj4xsOlEUXVYBBEw==
Received: by filterdrecv-84b96456cb-zd4xh with SMTP id
 filterdrecv-84b96456cb-zd4xh-1-6502E890-A
 2023-09-14 11:03:44.135318015 +0000 UTC m=+10927530.760105120
Received: from earth.catern.com (unknown) by geopod-ismtpd-22 (SG) with ESMTP
 id 2nl0BncCS_m_-Lgammhxgw Thu, 14 Sep 2023 11:03:43.397 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=gnu.org 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id 4966765674;
 Thu, 14 Sep 2023 07:03:42 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <83edj1mja5.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 14 Sep
 2023 08:10:58 +0300")
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN>
 <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
 <83edj1mja5.fsf@HIDDEN>
Date: Thu, 14 Sep 2023 11:03:44 +0000 (UTC)
Message-ID: <87il8dt3sh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbIOnyHASvNJhhaui0lq+6?=
 =?us-ascii?Q?SDln5iM21jX0qMLrjCdMDzaMx3kRWoX454Ec+ZB?=
 =?us-ascii?Q?IgTEvQv++Cw7ZGLOUVByNR93IR+9CTHrZfiX00b?=
 =?us-ascii?Q?QtUSzKNiP0Ha5qT12trxFRvSADc3HaddLNBtnJ+?=
 =?us-ascii?Q?vdMkAEn5=2FnQddynAW9msIx0HiGUk85SHJzw=3D=3D?=
To: Eli Zaretskii <eliz@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: Jim Porter <jporterbugs@HIDDEN>, sbaugh@HIDDEN,
 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Wed, 13 Sep 2023 12:33:01 -0700
>> Cc: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs@HIDDEN>
>> 
>> On 9/13/2023 12:13 PM, Eli Zaretskii wrote:
>> > And I don't understand why we need to add any options to Emacs itself,
>> > btw.  The suggestion to have some "symmetry" here was one of the
>> > reasons that discussion got nowhere.  So let's learn from that
>> > mistake, at least.
>> 
>> There's a practical benefit to this. If you have $EDITOR set in your 
>> environment to something like "emacsclient --alternate-editor=emacs", 
>> then it would be nice if you could say this:
>> 
>>    $EDITOR --apply some-func arg1 arg2
>> 
>> and have it do the same thing whether or not there was already an Emacs 
>> server running. The symmetry between the two commands (plus proper 
>> argument forwarding) would make that work.
>> 
>> However, if people can't agree, then we could probably drop that part. 
>> To me, it sounds like people *do* agree that this would be good to have 
>> though.
>
> People might agree, but I don't.  Please consider the perspective.
> This started as an obscure and rare problem in a desktop file (which
> we provided solely out of good will, since it really isn't our job to
> do so, it's the job of downstream distros).  The proposed solution was
> to add a completely new option to emacsclient, with its own special
> syntax and rules about what can and cannot be done with it.  This is
> already something that should raise brows: how can such an unimportant
> reason cause us to make such significant changes?  We didn't yet
> finish discussing that nor even had time to understand all the
> implications (remember: Lars suggested to support several such
> options, which required another special option), and we already are
> told that "for symmetry" we should add the same to Emacs.  All that
> where just yesterday there was no need for any new options in either,
> and if we decided to drop those desktop files from our sources (which
> I personally am tempted to do every few weeks, due to issues they
> cause us all the time since their introduction), then even the
> original need will miraculously disappear into thin air.

The issue is not really with the desktop file.  It's a generic problem:
Suppose I have some arbitrary data which I want to send to the Emacs
server (in this case, a URI).  Today, there's no easy way to do that.

- One approach is to stick the data inside an --eval call, as
  emacsclient-mail.desktop is doing.  Getting the quoting right is hard
  and complex, and even Emacs developers have failed at it over multiple
  iterations, and when they fail it either breaks or exposes a security
  vulnerability.  It is currently broken for me.

- Another approach is to do what org-protocol does (shipped with
  Emacs!), and advise server-visit-files (with
  org-protocol-check-filename-for-protocol), and pass the data as a
  string FILE argument to emacsclient which gets intercepted by advice.
  But this is of course a gross hack, and also it still requires
  escaping the data, since some characters will still be specially
  interpreted.  It would be nice to get rid of this org-protocol hack
  which is shipped with Emacs.

- A third approach is to put the data in a temporary file and pass the
  path of that file to emacsclient, then use an --eval to process the
  file.  But this doesn't work when emacsclient and the Emacs server are
  on different hosts or in different environments.

- Finally, a fourth approach is to teach emacsclient to be able to send
  this arbitrary data to Emacs on its own.  Such as by adding --apply.
  There are a bunch of designs for that, but all of them require
  modifying emacsclient.

I have many times before wanted to be able to pass data to Emacs without
worrying about escaping.  This would be a very useful feature to have.
And it would be nice to get rid of the org-protocol hack, and get rid of
the complicated and broken escaping needed for things like
emacsclient-mail.desktop.

> So this is a classic case of the tail wagging the dog.
>
> What about alternative solutions: use a shell script in the desktop
> files, and delegate to that script to solve the problem with quoting?
> Had anyone considered this strategy?  If not, why not?

Getting the quoting right is hard and complex, and even Emacs developers
have failed at it over multiple iterations, and when they fail it either
breaks or exposes a security vulnerability.  This solution is far
simpler, and is reusable for many other different purposes.

> I would in general prefer not to add any new options to our programs
> due to this weak reason.  Once again: it is not our job to get these
> desktop files right in every single downstream environment, so let's
> not make it our problem, certainly not a problem we should solve using
> such non-trivial solutions.

We don't have to add it to Emacs itself.  But it's not just for the
desktop files.  It's a relatively small feature to add to emacsclient,
and it's something that I've heard years of user requests for.

I have many times before wanted to be able to pass data to Emacs without
worrying about escaping.  This would be a very useful feature to have.
It would be nice to get rid of the org-protocol hack, and get rid of the
complicated and broken escaping needed for things like
emacsclient-mail.desktop.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 05:11:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 14 01:11:32 2023
Received: from localhost ([127.0.0.1]:36500 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgedW-0000qA-6T
	for submit <at> debbugs.gnu.org; Thu, 14 Sep 2023 01:11:32 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:36462)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgedU-0000pq-TW
 for 65902 <at> debbugs.gnu.org; Thu, 14 Sep 2023 01:11:29 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgedH-0001El-EY; Thu, 14 Sep 2023 01:11:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=sR6oLOlMwRREl5GogAaCuJ2oalJ5PZ6d995/rbK0DAY=; b=Cr8ukZZJPNCo
 Ti/pNe+nkyUrKpSUlQhNfpJJdAh3zIUBATlNzZMHIkesFcx3K51j6twHFpXjiQeGsIA9ETSlrty5i
 L4Mc79Dj8jODRqPZMF5xVxw/tLOfwqoY33ftiPyNS65lEPO/ysMI6Rfbit8UjynneHMei/bFrDPj7
 wqYyzfgobyYQXd4JdHFSo24TSOnKNZfaEJky34zIfCcF56ytZLQ+AO5+jt86p52M91NxfC4Cu/ZL/
 CbnNfNSQE7fUS9rsTYMxEt+t4yupH3rvth6RVQCy5rEiXMiNojNqBi7iKS8aGGLrFOyaxAzkfSMJT
 v0HXYrUGwa02yL6Fwi0mWQ==;
Date: Thu, 14 Sep 2023 08:10:58 +0300
Message-Id: <83edj1mja5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN> (message from
 Jim Porter on Wed, 13 Sep 2023 12:33:01 -0700)
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN> <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, sbaugh@HIDDEN, sbaugh@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 13 Sep 2023 12:33:01 -0700
> Cc: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> On 9/13/2023 12:13 PM, Eli Zaretskii wrote:
> > And I don't understand why we need to add any options to Emacs itself,
> > btw.  The suggestion to have some "symmetry" here was one of the
> > reasons that discussion got nowhere.  So let's learn from that
> > mistake, at least.
> 
> There's a practical benefit to this. If you have $EDITOR set in your 
> environment to something like "emacsclient --alternate-editor=emacs", 
> then it would be nice if you could say this:
> 
>    $EDITOR --apply some-func arg1 arg2
> 
> and have it do the same thing whether or not there was already an Emacs 
> server running. The symmetry between the two commands (plus proper 
> argument forwarding) would make that work.
> 
> However, if people can't agree, then we could probably drop that part. 
> To me, it sounds like people *do* agree that this would be good to have 
> though.

People might agree, but I don't.  Please consider the perspective.
This started as an obscure and rare problem in a desktop file (which
we provided solely out of good will, since it really isn't our job to
do so, it's the job of downstream distros).  The proposed solution was
to add a completely new option to emacsclient, with its own special
syntax and rules about what can and cannot be done with it.  This is
already something that should raise brows: how can such an unimportant
reason cause us to make such significant changes?  We didn't yet
finish discussing that nor even had time to understand all the
implications (remember: Lars suggested to support several such
options, which required another special option), and we already are
told that "for symmetry" we should add the same to Emacs.  All that
where just yesterday there was no need for any new options in either,
and if we decided to drop those desktop files from our sources (which
I personally am tempted to do every few weeks, due to issues they
cause us all the time since their introduction), then even the
original need will miraculously disappear into thin air.

So this is a classic case of the tail wagging the dog.

What about alternative solutions: use a shell script in the desktop
files, and delegate to that script to solve the problem with quoting?
Had anyone considered this strategy?  If not, why not?

I would in general prefer not to add any new options to our programs
due to this weak reason.  Once again: it is not our job to get these
desktop files right in every single downstream environment, so let's
not make it our problem, certainly not a problem we should solve using
such non-trivial solutions.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 20:17:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 16:17:11 2023
Received: from localhost ([127.0.0.1]:36146 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgWIR-000762-GL
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 16:17:11 -0400
Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:56385)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1qgWIL-00075I-Q8
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 16:17:10 -0400
Received: by mail-pl1-x631.google.com with SMTP id
 d9443c01a7336-1c3d6d88231so1712105ad.0
 for <65902 <at> debbugs.gnu.org>; Wed, 13 Sep 2023 13:17:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1694636214; x=1695241014; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=IHE+8ysMfov6Vqntvfxo86lTBD8ipiD6Sg6CHzf9Hmg=;
 b=c2p+2/PiP5oCMGt0MkLuNhF0Fv+UX18qYS0F01VuBoclF1sBKZeIOXnflFM8MxoVlh
 BZ38s7YvFSGY+448reDQrz/OFTCZF4f9vttQzypc9ovB9Z++gMRTLmtBJjUAtxHXVGDv
 g8qNRvGKrWlXQyxrVRkn6j3HYyILhrqJ7y1WU3pLYFLM7NoM3CGbIx7OK3UlBf67FRMx
 hFui9VWuVS/Jt6qohJOyh9+TqrVSEaLtt65Dw7EIPkqjKFIACbh78V4DXzVOMRz9cVGe
 /562cuRAhBJqKc6A4ot4FwsIV1E7UzgWRqx/YTAybwOknGObA0rIB0RXXcNeXGp3QMIu
 n7ZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1694636214; x=1695241014;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=IHE+8ysMfov6Vqntvfxo86lTBD8ipiD6Sg6CHzf9Hmg=;
 b=OXl6s59qsy+1LTs75MSCMUiUT/GtlTjP1RXunbwLfRA3H9Ld5AhJ2qz58iGTSvy7Al
 5vjy2qPAAjbLrptGPd2WUvs2vgrq4s8/KBBZs3hqsCVOy7YHobWyKaaFkXqhgR08r/uG
 2D8V2qtJrOUNYnSxJPInnS4YVs/MU/8b4izbPFHe+fQD+XuY8JzhY9b5BuzxpZGPSHjv
 MERyvlhOyfzDWGed6rPNZxdm4FjZYZ97GCAFoRnM++CtT0Em9+HCS+GsVnsdZ51oO8bQ
 FU4mNfVC4m1RtHIAtsewdjPwOxdDWTTMLg9VQM7qQ2pphZWEzhXonRnShGV4KfQE81XB
 W0Iw==
X-Gm-Message-State: AOJu0YxMqJdbf3XHmld880UOnOYWb2vTQBaxCEyZWOVW5UEM4UtSoorz
 LL8rCmNFZIEJj4G3dWRwyA8=
X-Google-Smtp-Source: AGHT+IFgAS9Im6PiSg+XRyFLDNnXtxi+J1cdNCp4TFJC3ZINWIgp48K+ATBgM//DQCZIC54IjTrqBQ==
X-Received: by 2002:a17:90a:9482:b0:273:c314:e112 with SMTP id
 s2-20020a17090a948200b00273c314e112mr3318228pjo.15.1694636214445; 
 Wed, 13 Sep 2023 13:16:54 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id
 mn6-20020a17090b188600b00263ba6a248bsm1896115pjb.1.2023.09.13.13.16.53
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 13 Sep 2023 13:16:54 -0700 (PDT)
Message-ID: <5d914d93-4c99-f809-4332-d50886ed112f@HIDDEN>
Date: Wed, 13 Sep 2023 13:16:54 -0700
MIME-Version: 1.0
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN> <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
 <ierr0n1aln7.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <ierr0n1aln7.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: sbaugh@HIDDEN, Eli Zaretskii <eliz@HIDDEN>, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 9/13/2023 1:00 PM, Spencer Baugh wrote:
> It doesn't work with --alternate-editor=emacs, but I think that is OK.
> I think the alternate-editor='' configuration is far more common, and
> that works just fine.

In that case, I think the benefits of "emacs --apply" are somewhat 
reduced, but it does still make some cases a bit easier. 
("emacs-mail.desktop" could use it, which would let us simplify the 
implementation of 'message-mailto' a little.)

Still, if we dropped "emacs --apply" I wouldn't stamp my feet about it. 
The main benefit is for emacsclient anyway, where it seems we have 
consensus.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 20:01:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 16:01:00 2023
Received: from localhost ([127.0.0.1]:36115 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgW2m-0006h2-7W
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 16:01:00 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:38715)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qgW2h-0006gl-S7
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 16:00:59 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN> (Jim Porter's
 message of "Wed, 13 Sep 2023 12:33:01 -0700")
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN>
 <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
Date: Wed, 13 Sep 2023 16:00:44 -0400
Message-ID: <ierr0n1aln7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: sbaugh@HIDDEN, Eli Zaretskii <eliz@HIDDEN>, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Jim Porter <jporterbugs@HIDDEN> writes:

> On 9/13/2023 12:13 PM, Eli Zaretskii wrote:
>> And I don't understand why we need to add any options to Emacs itself,
>> btw.  The suggestion to have some "symmetry" here was one of the
>> reasons that discussion got nowhere.  So let's learn from that
>> mistake, at least.
>
> There's a practical benefit to this. If you have $EDITOR set in your
> environment to something like "emacsclient --alternate-editor=emacs",
> then it would be nice if you could say this:
>
>   $EDITOR --apply some-func arg1 arg2
>
> and have it do the same thing whether or not there was already an
> Emacs server running. The symmetry between the two commands (plus
> proper argument forwarding) would make that work.

This already works out of the box with --alternate-editor='', no need
for any argument forwarding, and no need for support for this argument
in Emacs itself.

It doesn't work with --alternate-editor=emacs, but I think that is OK.
I think the alternate-editor='' configuration is far more common, and
that works just fine.

And we have not before done any special casing for forwarding arguments
from emacsclient to alternate-editor=emacs, so I don't think there's any
reason to start now.  (I personally think that alternate-editor=emacs is
somewhat ill-advised, since it doesn't ensure that the server gets
started)

That being said, supporting --apply in Emacs itself is fine with me,
although it's not strictly necessary since in Emacs itself,
--apply func --
is basically equivalent to
--eval (apply func command-line-args-left)

(This doesn't work in emacsclient, and would be very difficult to
support, so --apply is necessary for emacsclient)

> However, if people can't agree, then we could probably drop that
> part. To me, it sounds like people *do* agree that this would be good
> to have though.

I'm fine either way.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 19:33:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 15:33:16 2023
Received: from localhost ([127.0.0.1]:36087 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgVbw-0005wN-40
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 15:33:16 -0400
Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:42288)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1qgVbt-0005w8-4R
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 15:33:14 -0400
Received: by mail-pf1-x432.google.com with SMTP id
 d2e1a72fcca58-68fdd5c1bbbso152074b3a.1
 for <65902 <at> debbugs.gnu.org>; Wed, 13 Sep 2023 12:33:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1694633581; x=1695238381; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=F+gB88NaKCIgKBd70Uhc7uE9mZZes/1m/liM19sJvCs=;
 b=FcdcZ+FACBrazUMTD615NjjXLy9Luxw3u8ohVvGySbgVW6EcHEkw+INNP38fvN3P8F
 LDELXiWtXCIXZcRDv20MtrdpVh6k4rK+4iyd/qyNCpjLgwUlJQwLxFQuPZ5mfBD8Gbf3
 OmYDNaNoRwV+VvzkCslW9zZ0XuQ6h0K8tSoOPTagW7NawCqduzbnN5+/iiYZJtiErxuI
 kq4g/r4FcEBdOwDbWyAtZjYUt0J9XoEO4hf6q+QpcsGNe+U+ull2dneap1OWbCAXwagu
 h/qjtyD8Ihx7ZTl8Ssad4VCX1aIKqQ0Q2Yk2xrFARARaj2kxmw7ftjU8DX9+OCqV0FVv
 lohw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1694633581; x=1695238381;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=F+gB88NaKCIgKBd70Uhc7uE9mZZes/1m/liM19sJvCs=;
 b=LqrPrdq/VEXo5brgRKC5jUeu6CsNyusk2apzlwL9CM2VrHApI3wnXgNj2wFF1c8usw
 yqSsLhXaxPgFRq4qS9/99JThR/gDDmHuVo3m3ZPPcq3oLJ8V5yqlhdpS3IA3ODEysSDC
 osT/Luz/xTFC58kIW6iRj4jw8M8GbjVuWrCkPgxoo2dP5pxH/+SCWuI0o8f3wczVTQPe
 xmkaQv7IsNLqn/QdnFBD+bZeDgxUgUY3lV+9YemjLBzSoJ8UFff4eVPUwBt29eEECJU3
 ZjwwQmx/fuFMF+Ys3koaTKWPAy95eTLXcCAGuLkFo6sKWQ+UPFiDOKZa5UvIFX78coE9
 5JWA==
X-Gm-Message-State: AOJu0YzTAbkqxw4NMlBX8WySaojFAa0NDWDcrjxBL3x8cbSjLpZ+l5fs
 Ln365LyLngMsaGs0Vi/dDno=
X-Google-Smtp-Source: AGHT+IEBsjJiFTdPI4fEeF9bkB81AbSBUORHtPzsEV2Doq7IMTHe938AjmgjKO3sV6Qa6tvcvSitcA==
X-Received: by 2002:a05:6a21:a5a2:b0:138:68b9:138e with SMTP id
 gd34-20020a056a21a5a200b0013868b9138emr10680399pzc.8.1694633581358; 
 Wed, 13 Sep 2023 12:33:01 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id
 o6-20020a639206000000b0056c3a4a3ca5sm9182434pgd.36.2023.09.13.12.33.00
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 13 Sep 2023 12:33:00 -0700 (PDT)
Message-ID: <66a6c09e-3b61-d913-5638-4c804fb826f6@HIDDEN>
Date: Wed, 13 Sep 2023 12:33:01 -0700
MIME-Version: 1.0
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>, Spencer Baugh <sbaugh@HIDDEN>
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
 <83led9nay9.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <83led9nay9.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 9/13/2023 12:13 PM, Eli Zaretskii wrote:
> And I don't understand why we need to add any options to Emacs itself,
> btw.  The suggestion to have some "symmetry" here was one of the
> reasons that discussion got nowhere.  So let's learn from that
> mistake, at least.

There's a practical benefit to this. If you have $EDITOR set in your 
environment to something like "emacsclient --alternate-editor=emacs", 
then it would be nice if you could say this:

   $EDITOR --apply some-func arg1 arg2

and have it do the same thing whether or not there was already an Emacs 
server running. The symmetry between the two commands (plus proper 
argument forwarding) would make that work.

However, if people can't agree, then we could probably drop that part. 
To me, it sounds like people *do* agree that this would be good to have 
though.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 19:13:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 15:13:49 2023
Received: from localhost ([127.0.0.1]:36055 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgVJ7-0005RT-5Q
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 15:13:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34634)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgVJ4-0005RF-B2
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 15:13:48 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgVIr-0000E3-Tj; Wed, 13 Sep 2023 15:13:33 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=bV/vNxfADuTWDvymo8URuOyTi2ZfWISzlE/Kdi1Wu8Q=; b=QmgKeUEKdmd3
 zSRKb1YjIn3AymKnbe0fy/oL2VE2TET8UXGRx5AGDCTY2SEFxATrUvg0lQoQcJS5gfNDZZebh5Bn1
 Q8lsi9Fo3P32Qo8RplA3YuXwqRK8ezHkGfW06IrT4EcYKv5l/PFsZ8Ku1dnzhSffmkIfOzwZ5N23X
 w/SG23SStc6pHaAbEVvkQxTyD6Sz1MiBWi8ydBan47H3zNhrCUGgHLwodtd/E322IjCVwEiwh0f44
 nPWo+AR3cDpv+YZlDcVe774KMiPfK3DDrzmMO0MUCKWkwu/FSugE4okn8gcNclLDADjH6oaM0Eq5x
 +AjbsdZQJoxmM1wJv5y9Ow==;
Date: Wed, 13 Sep 2023 22:13:18 +0300
Message-Id: <83led9nay9.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <ierttry9jxh.fsf@HIDDEN> (message from Spencer Baugh on
 Wed, 13 Sep 2023 11:23:06 -0400)
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Spencer Baugh <sbaugh@HIDDEN>
> Cc: Spencer Baugh <sbaugh@HIDDEN>,  65902 <at> debbugs.gnu.org
> Date: Wed, 13 Sep 2023 11:23:06 -0400
> 
> >> Agreed, I think we reached a consensus in that bug and now I am implementing that consensus.
> >
> > AFAIU, there was no consensus reached there, so I'm unsure what are
> > you alluding to here.
> 
> Everyone in that thread agreed that something like this --apply design
> (which passes the strings verbatim to Emacs without evaling them) is
> what we need, they were just discussing the exact design, and in the end
> the design that everyone who posted agreed on, matched what I have
> implemented...

That's not my reading of that long discussion.

And I don't understand why we need to add any options to Emacs itself,
btw.  The suggestion to have some "symmetry" here was one of the
reasons that discussion got nowhere.  So let's learn from that
mistake, at least.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 16:19:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 12:19:33 2023
Received: from localhost ([127.0.0.1]:35778 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgSaR-0001O3-Ve
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 12:19:33 -0400
Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:55552)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1qgSaM-0001Nm-Jo
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 12:19:30 -0400
Received: by mail-pj1-x102b.google.com with SMTP id
 98e67ed59e1d1-269304c135aso1077a91.3
 for <65902 <at> debbugs.gnu.org>; Wed, 13 Sep 2023 09:19:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1694621955; x=1695226755; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=OHDn5s8z/6fcimqjedTQ2kMb1v/0mmyEkORwPSLsM9s=;
 b=monkQVbF8KFt3yr5l9RUw2IxwDxVW7TGFE6+BBOJb0MBFCjYzWgTbNlA6jRztUXgBY
 Alcc2JTKUbxVY/3PsvMkwPeLFkkWk3YtUXGvF7kbb22RTvJicOFdrdFKrU8DdjnPFM3G
 8KeKJVnrzYdiFpbqh6SHbEEMcBDPLNrsXcCTjP/p6+Vkz95mSHPIj0WQRKtYlSwlQkc+
 vzGGE7G26cwyZQdgf2kZZJ7AsDts7fEZYNl22ijrUymgCjfMTiclsR033hE7SZtNFsA0
 u4ijj0pn7DnJQEGD/hiEwxIVa8/x5MLOwH2KT82oi0wyyd0mH+AFbxTNZrnYJtTVUYhY
 3a5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1694621955; x=1695226755;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=OHDn5s8z/6fcimqjedTQ2kMb1v/0mmyEkORwPSLsM9s=;
 b=MLRn7g+kD1XogMmnTz2zRm2kOIVdt9oP+C+tDXhOoSPxg0DC8wOWqDjwqFoO3K1Bcw
 9fScbt8mVx0reXaiGpYGTAfi2b5PojsZ+RInHVHvkI4TDHFMImHTCtrfwPq2Kd3Hd+bS
 DUix7SdfjNArANjY3NhnoL1qXC6V3dwO8Hs2BgkgEmVJLJJ6FAD5vtMhHeVIWQFa4LTS
 JRfH2sRjA+JlwpLRXKRZ0SwhnnyRkX/IF2/uvyGgzrUxscuqGbM5dlQ5ZInCbb4BLDZr
 /zn1z7/aro8172AWZS+oMsWzpFJlUeCzgb7eH1C1uRz6rG5JEomopexOZlqNaCMyqQ9j
 ABOQ==
X-Gm-Message-State: AOJu0YyuPFyPEek1Q5I/wt33kzwOi4xx8MI2BVN7QYDRXQV0FN+kQlCe
 bFeWpAY0De89t+8uSf0GBIA=
X-Google-Smtp-Source: AGHT+IGNS8jd8xbl6b2MBvvpNcRXJQ0a92RlNxmKB8cbxomg3ZR7n2cjRd0MuciQqE2WrIpEAN7QDg==
X-Received: by 2002:a17:90b:192:b0:26d:d7f:6779 with SMTP id
 t18-20020a17090b019200b0026d0d7f6779mr2505449pjs.27.1694621955412; 
 Wed, 13 Sep 2023 09:19:15 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id
 lt12-20020a17090b354c00b00263154aab24sm1658196pjb.57.2023.09.13.09.19.14
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 13 Sep 2023 09:19:15 -0700 (PDT)
Message-ID: <75258dc0-4593-0dd2-f00d-965b37763fd4@HIDDEN>
Date: Wed, 13 Sep 2023 09:19:15 -0700
MIME-Version: 1.0
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN> <ierttry9jxh.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <ierttry9jxh.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: Spencer Baugh <sbaugh@HIDDEN>, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 9/13/2023 8:23 AM, Spencer Baugh wrote:
> Eli Zaretskii <eliz@HIDDEN> writes:
>> AFAIU, there was no consensus reached there, so I'm unsure what are
>> you alluding to here.
> 
> Everyone in that thread agreed that something like this --apply design
> (which passes the strings verbatim to Emacs without evaling them) is
> what we need, they were just discussing the exact design, and in the end
> the design that everyone who posted agreed on, matched what I have
> implemented...  I don't think we need to relitigate it.

That was my impression as well. Most of the discussion in that bug was 
among Robert (already commenting on this bug in agreement with the 
current patch), Gregory (who I believe supports the --apply design[1]), 
Lars (who proposed a form of the --apply design to handle multiple 
--apply calls[2]), and me (I support --apply, using Lars' semantics if 
we can get it).

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57752#119
[2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57752#122




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 15:23:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 11:23:22 2023
Received: from localhost ([127.0.0.1]:35665 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgRi6-0005ds-8y
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 11:23:22 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:55893)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qgRi2-0005dc-0z
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 11:23:21 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <83ttrym8jx.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 13 Sep
 2023 17:50:26 +0300")
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN>
Date: Wed, 13 Sep 2023 11:23:06 -0400
Message-ID: <ierttry9jxh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: Spencer Baugh <sbaugh@HIDDEN>, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:
>> Date: Wed, 13 Sep 2023 14:08:01 +0000 (UTC)
>> From: Spencer Baugh <sbaugh@HIDDEN>
>> Cc: 65902 <at> debbugs.gnu.org
>> 
>> On Sep 13, 2023 09:26, Eli Zaretskii <eliz@HIDDEN> wrote:
>> 
>>  > I am not sure what you're suggesting.  Can you show how the equivalent 
>>  > of: 
>>  > 
>>  > emacsclient --apply message-mailto -- %u 
>>  > 
>>  > would work with that design? 
>> 
>>    emacsclient --qeval '(message-mailto %u)'
>> 
>> I don't think this can work in general for arbitrary user input: what if %u is replaced with something
>> that contains parentheses?
>
> They are inside '..', so the only one who'd care is Emacs, not the
> shell.

Agreed.  The problem I'm referring to is in Emacs, interpreting
arbitrary input from the web as code.  (The .desktop commands don't even
use a shell, a shell doesn't need to be involved at any point)

> In which case it's the job of whoever provides the value for
> %u to handle that.

The value for %u is an arbitrary string from some other application
which wants to open a mailto: URI, and passes it to xdg-open which then
passes it to Emacs.  Other applications are not aware of what escaping
is needed to make Emacs not interpret it as code.  And indeed, there's
no point in doing that: Emacs is in the best position to do that
escaping, if it needs to be done.

> And anyway, how is that different from the same problem happening with
> your suggested --funcall or --apply? they will bump into the same
> issues.

No, they won't: --apply passes the arguments as a string, without ever
trying to parse them as Lisp.

Let's be concrete: imagine %u is replaced with
(shell-command "rm -r /")
as could happen if an application receives some malicious input.

The command line with --qeval is:
emacsclient --qeval '(message-mailto (shell-command "rm -r /"))'

Emacs receives
-eval (message-mailto (shell-command "rm -r /"))
and evals
(message-mailto (shell-command "rm -r /"))
and deletes your files.

The command line with --apply is:
emacsclient --apply message-mailto '(shell-command "rm -r /")'

Emacs receives
-apply message-mailto --applyarg (shell-command "rm -r /")
and evals
(message-mailto "(shell-command \"rm -r /\")")
and nothing bad happens.

Emacs just needs to get the verbatim string without trying to parse it
as Lisp at any point.  This is an extremely standard security technique
when dealing with malicious input, which is why the previous thread
converged on it so quickly.

>>  Let's not do that this time, okay?
>> 
>> Agreed, I think we reached a consensus in that bug and now I am implementing that consensus.
>
> AFAIU, there was no consensus reached there, so I'm unsure what are
> you alluding to here.

Everyone in that thread agreed that something like this --apply design
(which passes the strings verbatim to Emacs without evaling them) is
what we need, they were just discussing the exact design, and in the end
the design that everyone who posted agreed on, matched what I have
implemented...  I don't think we need to relitigate it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 15:01:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 11:01:15 2023
Received: from localhost ([127.0.0.1]:35642 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgRMh-00054O-EV
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 11:01:15 -0400
Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]:58312)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <schwab@HIDDEN>) id 1qgRMd-000549-VH
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 11:01:14 -0400
Received: from relay2.suse.de (relay2.suse.de [149.44.160.134])
 by smtp-out2.suse.de (Postfix) with ESMTP id D35B41F390;
 Wed, 13 Sep 2023 15:01:00 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
 t=1694617260; h=from:from:reply-to: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;
 bh=hm6puBdSx8iMFsDQpiaYumdgN8wW3ryi7Bbjeb8TOl4=;
 b=kRnKk62XOKHwR/f/SfGFRHvY5oBfv4IgpRZDboIQCzXW5n8bA3lXjNrrFmb5W9MLko6DUC
 iTnzudAVzHsR+xpO0IBxq59vLjL60mLy2JnDwx/x5ioLEiLDCpWIPNSExdPT/8YeN7ZFCi
 gWnUIiTaBS/EiQskgLBDCxidC2Dc/bo=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
 s=susede2_ed25519; t=1694617260;
 h=from:from:reply-to: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;
 bh=hm6puBdSx8iMFsDQpiaYumdgN8wW3ryi7Bbjeb8TOl4=;
 b=hExPg7+l9wcr0Fmh/X7Xb1gDyuF2qk7vADYhUta5KxRffXdL+ufLsv7OmmyAxHPxSn5CGy
 AOxpo1UP9/EulaAg==
Received: from hawking.nue2.suse.org (unknown [10.168.4.11])
 by relay2.suse.de (Postfix) with ESMTP id AABE92C142;
 Wed, 13 Sep 2023 15:01:00 +0000 (UTC)
Received: by hawking.nue2.suse.org (Postfix, from userid 17005)
 id 8D4934A04B1; Wed, 13 Sep 2023 17:01:00 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <83ttrym8jx.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 13 Sep
 2023 17:50:26 +0300")
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
 <83ttrym8jx.fsf@HIDDEN>
X-Yow: I'm totally DESPONDENT over the LIBYAN situation and the price of
 CHICKEN..
Date: Wed, 13 Sep 2023 17:01:00 +0200
Message-ID: <mvm8r9axglv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: Spencer Baugh <sbaugh@HIDDEN>, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On Sep 13 2023, Eli Zaretskii wrote:

> They are inside '..', so the only one who'd care is Emacs, not the
> shell.  In which case it's the job of whoever provides the value for
> %u to handle that.

The spec does not allow that.  The %u marker cannot be part of a quoted
argument.

-- 
Andreas Schwab, SUSE Labs, schwab@HIDDEN
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 14:50:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 10:50:54 2023
Received: from localhost ([127.0.0.1]:35605 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgRCg-000282-0k
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 10:50:54 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51468)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgRCf-00027q-AJ
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 10:50:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgRCT-0000jg-Et; Wed, 13 Sep 2023 10:50:41 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=kJ8O4HxBrVPJT1J0JJJg+EPSd9GtTPE823JAwxNEdaY=; b=mvvfnpGu/Hm4
 G5msQsSIlARsxCEEbcWGKtL2DY/9NSxrNvmPZ6w0FVbudF1rJIsJCwA1ptvbWPuctCqsk0FpJhVqE
 B/jZGakfxMPBvou3Qzamqpl7WJNEBtIz1vrd2pGoOsBVmqHgPY6Hb6qj7cWnIcpVqmXqe1HXKAqMv
 18yq2eXN02So9DOcIb8Jf5bZup7LJlgF6uO9PyjmVnnFGAOIGOaJDSgt6po0FD5l9vNF8iiGbqa4N
 NwuwflAS6bTetM/cN90a1FYoZ5YkwqCk8Gnvs4zXxF+HWncfRpYQOTlp8uL4dRhScCuildWhbSXhp
 I3+wUxKTuwP44UEvT6j6Qg==;
Date: Wed, 13 Sep 2023 17:50:26 +0300
Message-Id: <83ttrym8jx.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN> (message
 from Spencer Baugh on Wed, 13 Sep 2023 14:08:01 +0000 (UTC))
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
References: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 13 Sep 2023 14:08:01 +0000 (UTC)
> From: Spencer Baugh <sbaugh@HIDDEN>
> Cc: 65902 <at> debbugs.gnu.org
> 
> On Sep 13, 2023 09:26, Eli Zaretskii <eliz@HIDDEN> wrote:
> 
>  > I am not sure what you're suggesting.  Can you show how the equivalent 
>  > of: 
>  > 
>  > emacsclient --apply message-mailto -- %u 
>  > 
>  > would work with that design? 
> 
>    emacsclient --qeval '(message-mailto %u)'
> 
> I don't think this can work in general for arbitrary user input: what if %u is replaced with something
> that contains parentheses?

They are inside '..', so the only one who'd care is Emacs, not the
shell.  In which case it's the job of whoever provides the value for
%u to handle that.

And anyway, how is that different from the same problem happening with
your suggested --funcall or --apply? they will bump into the same
issues.

>  Let's not do that this time, okay?
> 
> Agreed, I think we reached a consensus in that bug and now I am implementing that consensus.

AFAIU, there was no consensus reached there, so I'm unsure what are
you alluding to here.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 14:23:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 10:23:16 2023
Received: from localhost ([127.0.0.1]:35509 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgQlh-0001GT-Lg
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 10:23:16 -0400
Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:58657)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1qgQlc-0001GB-0m
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 10:23:00 -0400
Received: by mail-wm1-x32e.google.com with SMTP id
 5b1f17b1804b1-401b393df02so80264465e9.1
 for <65902 <at> debbugs.gnu.org>; Wed, 13 Sep 2023 07:22:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1694614964; x=1695219764; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=Tcvls7NE+i/fKwFV3CuJDMyDonj8rk1QUAZebI8udm0=;
 b=WbrlUrwKsmiH8gYa2m/OQY6Wa3QgYpWUnnRN8VIkFiHXfg83UlILhfK+jHDpLGGkx/
 ruVGcVJhVvoozWySLJsIUlSAWtQ1RPGKFDw+yp7EeMSpmm28n5FbkviPL2lGjXWK50bw
 7crIKr62hWMhnNiU2DSQyconDaX6c8eRjgt94s5DQMdHsqycwLUIxEEH/shks7BcQeQu
 AVxKpALNPHaIxqRrRerarpdO1A7n43zrg7n20ZevOCN/frHzPX/Wz71dGgD4JlrSwQEz
 e0PE2t3ab5nOSxVzNT/vbwFgoRaVyI74zq3iY1OJGOMlcnFHKhtEh1wsyLfwy7JZOTs6
 m9KQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1694614964; x=1695219764;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Tcvls7NE+i/fKwFV3CuJDMyDonj8rk1QUAZebI8udm0=;
 b=o2HDn3zIV5B8PYwoy85x5m6PHFN2AWEp43+a0T7+4WG16Q69QtVVidQBNmnwCET58Q
 lKoyur/3eEKosXDoV/bz/ncFGoluztydAj6jSZIafksIusHTG0MydcYWeATsIy1PxHy6
 uB7oW9Ved57gmWjRz6pTFBi4Ivqio/JdZca1xoAwpDaDiV861LKBTRSWhF32uXzFMOAF
 oPp0euiPoJghP1K+LhO3LcQlxeu7UQGG4J1uueyfOnncvPBR60fxn4BlLDXo8wLFlR9Q
 EBE1OI2OASmcSkELedrN28/A/BZrXoRif4iEUob/K2BFXwDCJ7TyhWvLlUiFscMe1BrA
 C27w==
X-Gm-Message-State: AOJu0Yxaj9EtYTy89n5IM0L2toIgdiCf8WrBrXA3Z8WtbKhhwYKx9DCL
 uhLCWGkaOI02TVf3UAdJp12+OHZZDixjLQ==
X-Google-Smtp-Source: AGHT+IEXyA2KtjCm104q6rTSOH7O9dhbxvWHXyj54g13vTzead3l38oVZ/0ZEMawXFtU5HDJCx6F3w==
X-Received: by 2002:a05:600c:2242:b0:402:fec4:fddc with SMTP id
 a2-20020a05600c224200b00402fec4fddcmr2009799wmm.17.1694614964218; 
 Wed, 13 Sep 2023 07:22:44 -0700 (PDT)
Received: from rltb ([2a01:e0a:3f3:fb50:9eeb:e8ff:fe1b:1ad8])
 by smtp.gmail.com with ESMTPSA id
 f22-20020a1c6a16000000b003fc0505be19sm2161396wmc.37.2023.09.13.07.22.43
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 13 Sep 2023 07:22:43 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <83a5tqnry8.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 13 Sep
 2023 16:06:07 +0300")
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
 <d796795f-7900-9140-8443-12f812cf8983@HIDDEN>
 <87edj2ec5b.fsf@HIDDEN> <83a5tqnry8.fsf@HIDDEN>
Date: Wed, 13 Sep 2023 16:22:43 +0200
Message-ID: <87a5tqdufg.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, jporterbugs@HIDDEN, sbaugh@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> On Wed, 13 Sep 2023 16:06:07 +0300, Eli Zaretskii <eliz@HIDDEN> said:

    >> Cc: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
    >> From: Robert Pluim <rpluim@HIDDEN>
    >> Date: Wed, 13 Sep 2023 10:00:00 +0200
    >>=20
    >> >>>>> On Tue, 12 Sep 2023 20:46:54 -0700, Jim Porter <jporterbugs@gm=
ail.com> said:
    >>=20
    Jim> On 9/12/2023 7:30 PM, sbaugh@HIDDEN wrote:
    >> >> tags 65902 + patch
    >> >> quit
    >> >> This patch avoids the complicated scripting needed for
    >> >> emacsclient-mail.desktop by adding a new flag to emacsclient, --f=
uncall,
    >> >> which mirrors emacs --funcall and allows emacsclient-mail.desktop=
 to be
    >> >> basically the same as emacs-mail.desktop.
    >>=20
    Jim> I think this is actually the same as the (very long) bug#57752, so
    Jim> thanks for working on this. (It was on my list of things to get to,
    Jim> but I just haven't had time.)
    >>=20
    >> 57752 got bogged down in design paralysis :-)

    Eli> And where do you think we will get here, if we retrace all the
    Eli> arguments and counter-arguments voiced there?

I was not intending to do that, I was intending to advocate for
Spencer=CA=BCs work to go in pretty much as-is (modulo calling it '--apply'
rather than '--funcall').

Robert
--=20




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 14:08:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 10:08:16 2023
Received: from localhost ([127.0.0.1]:35490 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgQXQ-0000tt-C3
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 10:08:16 -0400
Received: from s.wfbtzhsw.outbound-mail.sendgrid.net ([159.183.224.105]:30634)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-39fe-65902=debbugs.gnu.org@HIDDEN>)
 id 1qgQXN-0000td-W5
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 10:08:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=subject:in-reply-to:from:mime-version:to:cc:content-type:
 content-transfer-encoding:cc:content-type:from:subject:to;
 s=s1; bh=NspA0M77QMMtXUfKWUTieOgOkSUDSJtJBHHHZ4SRzJs=;
 b=QzaLvZ14mhnH5V8AdHjhZcRrblGa/WxiTwfqbzQjC7N4pJp0ZWIlWx+epTKYo8GP5C5W
 p57dqVtMNM5IBOskb+DJ/9/qfqA9T+2cQjDrX5019pcTzI9fEfE1deeqCcj4vQJhZtt0rd
 elQ0P/2mEVdsnJqFSiSFdAaebibY20fIWkTfm3BfyeGAo9Y0+jqAzxvRF1N89LqKKBKZDI
 yBNVZCfYeUMZGItzxBlRQApPQwvx6zC3Ty1Sznxy5b1bTOKYvbMTT0A+SefsacgreO9imX
 XWoXbnOnpTld110Yx5ym5YxlPnbRVHD6L6ZPzajR4LSY5716c5wbhLRU7ppsuaIg==
Received: by filterdrecv-7765c6879f-sjjbz with SMTP id
 filterdrecv-7765c6879f-sjjbz-1-6501C241-B2
 2023-09-13 14:08:01.661924256 +0000 UTC m=+2933147.434190176
Received: from earth.catern.com (unknown) by geopod-ismtpd-3 (SG) with ESMTP
 id YyKFgKvDTdyYyehARFEF5A Wed, 13 Sep 2023 14:08:01.537 +0000 (UTC)
Date: Wed, 13 Sep 2023 14:08:01 +0000 (UTC)
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
Message-ID: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
X-Android-Message-ID: <fe2cc764-86c6-4840-80b7-8f3a3778b374@HIDDEN>
In-Reply-To: <837counr08.fsf@HIDDEN>
From: Spencer Baugh <sbaugh@HIDDEN>
Importance: Normal
X-Priority: 3
X-MSMail-Priority: Normal
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?GW3oCMoYnalRiojMOuLzE6x2H5kORXvlCdz1UwQVRMVT4fbh9ODEfCogOe74cO?=
 =?us-ascii?Q?rI4e0V+MFZgakz9Re5a6=2FCgg4ZtpyhtSdfUjWBt?=
 =?us-ascii?Q?rKJKkNb93mt+zUcxCYxQGI91zbA37ACbxMBspmN?=
 =?us-ascii?Q?Xpoqhtpj5J9ZrS5ttgxfM61MW4aQHZirj9wRlxI?=
 =?us-ascii?Q?JoXD2ZsJdkER0NlNFwpbBDEMM6mjP07W4pMQ99K?=
 =?us-ascii?Q?dFKmCbOpZ6NyxAIg5X2lO5jgvS3KgGc+NUfjo1?=
To: Eli Zaretskii <eliz@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: base64
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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:  On Sep 13, 2023 09:26, Eli Zaretskii <eliz@HIDDEN> wrote:
 > From: sbaugh@HIDDEN > Date: Wed, 13 Sep 2023 13:01:52 +0000 (UTC) >
 Cc: 65902 <at> debbugs.gnu.org > > Eli Zaretskii <eliz@HIDDEN> writes: > > >
 Is quoting the only issue with --eval? If so, why not [...] 
 Content analysis details:   (1.7 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [159.183.224.105 listed in wl.mailspike.net]
 0.1 MIME_HTML_ONLY         BODY: Message only has text/html MIME parts
 0.0 HTML_MESSAGE           BODY: HTML included in message
 0.0 MIME_BASE64_TEXT       RAW: Message text disguised using base64
 encoding
 0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
 lines
 0.6 HTML_MIME_NO_HTML_TAG  HTML-only message, but there is no HTML
 tag
 1.0 MALF_HTML_B64          Malformatted base64-encoded HTML content
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

PGRpdiBkaXI9J2F1dG8nPjxkaXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPjxkaXYgY2xhc3M9
ImdtYWlsX3F1b3RlIj5PbiBTZXAgMTMsIDIwMjMgMDk6MjYsIEVsaSBaYXJldHNraWkgJmx0O2Vs
aXpAZ251Lm9yZyZndDsgd3JvdGU6PGJyIHR5cGU9ImF0dHJpYnV0aW9uIj48YmxvY2txdW90ZSBj
bGFzcz0icXVvdGUiIHN0eWxlPSJtYXJnaW46MCAwIDAgLjhleDtib3JkZXItbGVmdDoxcHggI2Nj
YyBzb2xpZDtwYWRkaW5nLWxlZnQ6MWV4Ij48cCBkaXI9Imx0ciI+Jmd0OyBGcm9tOiBzYmF1Z2hA
Y2F0ZXJuLmNvbQo8YnI+CiZndDsgRGF0ZTogV2VkLCAxMyBTZXAgMjAyMyAxMzowMTo1MiArMDAw
MCAoVVRDKQo8YnI+CiZndDsgQ2M6IDY1OTAyQGRlYmJ1Z3MuZ251Lm9yZwo8YnI+CiZndDsgCjxi
cj4KJmd0OyBFbGkgWmFyZXRza2lpICZsdDtlbGl6QGdudS5vcmcmZ3Q7IHdyaXRlczoKPGJyPgom
Z3Q7IAo8YnI+CiZndDsgJmd0OyBJcyBxdW90aW5nIHRoZSBvbmx5IGlzc3VlIHdpdGggLS1ldmFs
PyZuYnNwOyBJZiBzbywgd2h5IG5vdCBoYXZlIGEgdmFyaWFudAo8YnI+CiZndDsgJmd0OyBvZiAt
LWV2YWwgdGhhdCBxdW90ZXMgdGhlIGFyZ3VtZW50IGJ5IGl0c2VsZiwgbGlrZSB5b3UgZG8gaW4g
dGhlCjxicj4KJmd0OyAmZ3Q7IHBhdGNoLCBpLmUuIGJ5IHVzaW5nIHF1b3RlX2FyZ3VtZW50LCBp
bnN0ZWFkIG9mIGludmVudGluZyB5ZXQgYW5vdGhlcgo8YnI+CiZndDsgJmd0OyB3ZWlyZCBvcHRp
b24gd2l0aCBpdHMgb3duIHNtYWxsIERTTCBhbmQgZXh0cmEtc3BlY2lhbCBydWxlcyBvZiBob3cg
dG8KPGJyPgomZ3Q7ICZndDsgd3JpdGUgdGhlIGNvbW1hbmQgbGluZSB3aXRoIGl0Pwo8YnI+CiZn
dDsgCjxicj4KJmd0OyBJIGFtIG5vdCBzdXJlIHdoYXQgeW91J3JlIHN1Z2dlc3RpbmcuJm5ic3A7
IENhbiB5b3Ugc2hvdyBob3cgdGhlIGVxdWl2YWxlbnQKPGJyPgomZ3Q7IG9mOgo8YnI+CiZndDsg
Cjxicj4KJmd0OyBlbWFjc2NsaWVudCAtLWFwcGx5IG1lc3NhZ2UtbWFpbHRvIC0tICV1Cjxicj4K
Jmd0OyAKPGJyPgomZ3Q7IHdvdWxkIHdvcmsgd2l0aCB0aGF0IGRlc2lnbj8KPGJyPgoKPGJyPgom
bmJzcDsgZW1hY3NjbGllbnQgLS1xZXZhbCAnKG1lc3NhZ2UtbWFpbHRvICV1KSc8L3A+PC9ibG9j
a3F1b3RlPjwvZGl2PjwvZGl2PjwvZGl2PjxkaXYgZGlyPSJhdXRvIj5JIGRvbid0IHRoaW5rIHRo
aXMgY2FuIHdvcmsgaW4gZ2VuZXJhbCBmb3IgYXJiaXRyYXJ5IHVzZXIgaW5wdXQ6IHdoYXQgaWYg
JXUgaXMgcmVwbGFjZWQgd2l0aCBzb21ldGhpbmcgdGhhdCBjb250YWlucyBwYXJlbnRoZXNlcz88
L2Rpdj48ZGl2IGRpcj0iYXV0byI+PGJyPjwvZGl2PjxkaXYgZGlyPSJhdXRvIj5BcyBmYXIgYXMg
SSBrbm93LCB0aGUgb25seSByb2J1c3Qgd2F5IGlzIHRvIHNlcGFyYXRlIGFyYml0cmFyeSBwb3Nz
aWJseS1tYWxpY2lvdXMgaW5wdXQgZnJvbSBhY3R1YWwgaW50ZXJwcmV0ZWQgY29kZSwgd2hpY2gg
aXMgd2hhdCB0aGlzIC0tYXBwbHkgYXJndW1lbnQgZG9lcy4mbmJzcDsgVGhlIHBvc3NpYmx5LW1h
bGljaW91cyBpbnB1dCBjYW4gdGhlbiBiZSBlc2NhcGVkIG9uIGl0cyBvd24sIHNlcGFyYXRlIGZy
b20gdGhlIGNvZGUgd2hpY2ggaXMgcHJvY2Vzc2VkIGRpZmZlcmVudGx5LjwvZGl2PjxkaXYgZGly
PSJhdXRvIj48ZGl2IGNsYXNzPSJnbWFpbF9leHRyYSI+PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUi
PjxibG9ja3F1b3RlIGNsYXNzPSJxdW90ZSIgc3R5bGU9Im1hcmdpbjowIDAgMCAuOGV4O2JvcmRl
ci1sZWZ0OjFweCAjY2NjIHNvbGlkO3BhZGRpbmctbGVmdDoxZXgiPjxwIGRpcj0ibHRyIj4KPGJy
PgoKPGJyPgomZ3Q7ICZndDsgTW9yZSBnZW5lcmFsbHksIEkgY2Fubm90IHNheSBJJ20gaGFwcHkg
dGhhdCB3ZSBiYXNpY2FsbHkgYXJlCjxicj4KJmd0OyAmZ3Q7IHJlaXRlcmF0aW5nIGV2ZXJ5dGhp
bmcgdGhhdCB3YXMgc2FpZCBpbiBidWcjNTc3NTIgaW5zdGVhZCBvZiBwaWNraW5nCjxicj4KJmd0
OyAmZ3Q7IHVwIHdoZXJlIGl0IGxlZnQgb2ZmLiZuYnNwOyBXaHkgaXMgaXQgdXNlZnVsIHRvIGhh
dmUgYW5vdGhlciBkaXNjdXNzaW9uCjxicj4KJmd0OyAmZ3Q7IGxpa2UgdGhhdCBvbmUgKHdoaWNo
IHdpbGwgcHJvYmFibHkgZW5kIHVwIGF0IHRoZSBzYW1lIGltcGFzc2UpPwo8YnI+CiZndDsgCjxi
cj4KJmd0OyBJIGFkbWl0IEkgZGlkbid0IHNlZSB0aGF0IGJ1ZyB1bnRpbCBub3csIGJ1dCB0aGUg
d2F5IGluIHdoaWNoIHRoaXMgaXMKPGJyPgomZ3Q7IGRpZmZlcmVudCBpcyB0aGF0IEkgaGF2ZSBu
b3cgcmVhZCB0aGUgZGlzY3Vzc2lvbiwgaW5jb3Jwb3JhdGVkIGFsbCB0aGUKPGJyPgomZ3Q7IGFk
dmljZSwgYW5kIEknbSBhY3R1YWxseSBpbXBsZW1lbnRpbmcgaXQgOikKPGJyPgoKPGJyPgpZb3Ug
YXJlIHdlbGwgdW5kZXIgd2F5IHRvIHJlYWNoIHRoZSBzYW1lIGZpbmFsIHBvaW50IHdlIGVuZGVk
IHVwCjxicj4KdGhlcmUsIGJlY2F1c2UgYm90aCB0aGUgYXJndW1lbnRzIHBlb3BsZSB2b2ljZSBo
ZXJlIGFuZCB5b3VyCjxicj4KcmVzcG9uc2VzL3JlYWN0aW9ucyBhcmUgdGhlIHNhbWUgYXMgd2Ug
c2F3IHRoZXJlLiZuYnNwOyBGb3IgZXhhbXBsZSwgd2UKPGJyPgphbHJlYWR5IGhhdmUgYW4gYWRk
aXRpb25hbCBvcHRpb24gdG8gRW1hY3MsIGFsdGhvdWdoIHRoZSBvcmlnaW5hbAo8YnI+CnByb2Js
ZW0gaGFkIG5vdGhpbmcgdG8gZG8gd2l0aCBFbWFjcyBpdHNlbGYuCjxicj4KCjxicj4KTGV0J3Mg
bm90IGRvIHRoYXQgdGhpcyB0aW1lLCBva2F5PzwvcD48L2Jsb2NrcXVvdGU+PC9kaXY+PC9kaXY+
PC9kaXY+PGRpdiBkaXI9ImF1dG8iPkFncmVlZCwgSSB0aGluayB3ZSByZWFjaGVkIGEgY29uc2Vu
c3VzIGluIHRoYXQgYnVnIGFuZCBub3cgSSBhbSBpbXBsZW1lbnRpbmcgdGhhdCBjb25zZW5zdXMu
PC9kaXY+PGRpdiBkaXI9ImF1dG8iPjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIj48ZGl2IGNsYXNz
PSJnbWFpbF9xdW90ZSI+PGJsb2NrcXVvdGUgY2xhc3M9InF1b3RlIiBzdHlsZT0ibWFyZ2luOjAg
MCAwIC44ZXg7Ym9yZGVyLWxlZnQ6MXB4ICNjY2Mgc29saWQ7cGFkZGluZy1sZWZ0OjFleCI+PHAg
ZGlyPSJsdHIiPgo8YnI+CjwvcD4KPC9ibG9ja3F1b3RlPjwvZGl2Pjxicj48L2Rpdj48L2Rpdj48
L2Rpdj4=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 13:27:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 09:27:06 2023
Received: from localhost ([127.0.0.1]:32944 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgPtZ-0002Mt-Kk
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 09:27:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35372)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgPtU-0002MV-5S
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 09:27:04 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgPtJ-0006og-5a; Wed, 13 Sep 2023 09:26:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=2Om+pWYXNDzs1ILTcIBMdoaKkpNXr5usKOJq2b16Df4=; b=mjx185gbWvRF
 gC7ULHe4I6IRtGMAI5yW7CenfEbkBDXeOCxH3jRNd+kQOv5j4EHPdAbaoa6qg9ahH+IvKjFYnUbp+
 uwbHFWp8D3TVCnwbEe2ObbNDAvj0bRmx5sRgUy1UKN1fWcrmzsDk8XNRnTCGe7jyqoRTAsSDPfcpp
 tGV2sVU+aZQnkVcXP+X+/z313Q7EukCWPmnGQcoBmgFeZBxR0wdgWaxZmGXP0r3OlXmABbZbPM6Tg
 14C8WkC31FOrELP14AaqL4te/OdYNembuUrYIMnQWiUCy4V7XGvxYhL8Xxv/9E8NGirUO+ydz9P+i
 NyxFbiwkUkHqdQE8o/H/mw==;
Date: Wed, 13 Sep 2023 16:26:31 +0300
Message-Id: <837counr08.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: sbaugh@HIDDEN
In-Reply-To: <87msxqtef4.fsf@HIDDEN> (sbaugh@HIDDEN)
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
 <83fs3int3t.fsf@HIDDEN> <87msxqtef4.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: sbaugh@HIDDEN
> Date: Wed, 13 Sep 2023 13:01:52 +0000 (UTC)
> Cc: 65902 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Is quoting the only issue with --eval?  If so, why not have a variant
> > of --eval that quotes the argument by itself, like you do in the
> > patch, i.e. by using quote_argument, instead of inventing yet another
> > weird option with its own small DSL and extra-special rules of how to
> > write the command line with it?
> 
> I am not sure what you're suggesting.  Can you show how the equivalent
> of:
> 
> emacsclient --apply message-mailto -- %u
> 
> would work with that design?

  emacsclient --qeval '(message-mailto %u)'

> > More generally, I cannot say I'm happy that we basically are
> > reiterating everything that was said in bug#57752 instead of picking
> > up where it left off.  Why is it useful to have another discussion
> > like that one (which will probably end up at the same impasse)?
> 
> I admit I didn't see that bug until now, but the way in which this is
> different is that I have now read the discussion, incorporated all the
> advice, and I'm actually implementing it :)

You are well under way to reach the same final point we ended up
there, because both the arguments people voice here and your
responses/reactions are the same as we saw there.  For example, we
already have an additional option to Emacs, although the original
problem had nothing to do with Emacs itself.

Let's not do that this time, okay?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 13:06:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 09:06:49 2023
Received: from localhost ([127.0.0.1]:32914 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgPZw-0001sc-St
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 09:06:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35454)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgPZr-0001ry-5j
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 09:06:44 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgPZg-0007TC-Fu; Wed, 13 Sep 2023 09:06:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=p70xN62ht52Am+Hm3WIZJStjPosWjVo977zbaMZbt+o=; b=VDmiPY7Kid+R
 ul1Ek8MEex5dhu+h6FCOFr18ZwhmK7iYtFTWIEZjF7yHAu7g4jP+ad6nn2aeE5Vvy+NU+yLPRI+nM
 HTyCSFgXCXpgaiPJzXIWrBGMwVYnCL/QHh8bdVUrKsLksDuG8EMrM4uvG2bFv3MbqrpjjstoemE9U
 C5oz+1DLbm2ULlnF9mp4m/V29Pemrg+M4B8W1DwKcuYL7QalMnkPQMakAC4Gu+YOi8emHqGHCyxKG
 7ZRZZaJtGVNYLWKXc5zrvn6icxlZVnFjtgindhIJyAqjei3XfKszI+5eyH1ZpMQ1Jt+rKmHS9h51o
 IFbE13KgchbPir2cLLvx4w==;
Date: Wed, 13 Sep 2023 16:06:07 +0300
Message-Id: <83a5tqnry8.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Robert Pluim <rpluim@HIDDEN>
In-Reply-To: <87edj2ec5b.fsf@HIDDEN> (message from Robert Pluim on Wed, 13
 Sep 2023 10:00:00 +0200)
Subject: Re: bug#65902: 29.0.92;
 emacsclient-mail.desktop fails due to complicated escaping
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
 <d796795f-7900-9140-8443-12f812cf8983@HIDDEN> <87edj2ec5b.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org, jporterbugs@HIDDEN, sbaugh@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
> From: Robert Pluim <rpluim@HIDDEN>
> Date: Wed, 13 Sep 2023 10:00:00 +0200
> 
> >>>>> On Tue, 12 Sep 2023 20:46:54 -0700, Jim Porter <jporterbugs@HIDDEN> said:
> 
>     Jim> On 9/12/2023 7:30 PM, sbaugh@HIDDEN wrote:
>     >> tags 65902 + patch
>     >> quit
>     >> This patch avoids the complicated scripting needed for
>     >> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall,
>     >> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be
>     >> basically the same as emacs-mail.desktop.
> 
>     Jim> I think this is actually the same as the (very long) bug#57752, so
>     Jim> thanks for working on this. (It was on my list of things to get to,
>     Jim> but I just haven't had time.)
> 
> 57752 got bogged down in design paralysis :-)

And where do you think we will get here, if we retrace all the
arguments and counter-arguments voiced there?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 13:02:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 09:02:05 2023
Received: from localhost ([127.0.0.1]:32897 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgPVM-0001lR-Mu
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 09:02:05 -0400
Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]:7066)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-39fe-65902=debbugs.gnu.org@HIDDEN>)
 id 1qgPVK-0001ku-VW
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 09:02:03 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:in-reply-to:references:mime-version:to:cc:content-type:
 content-transfer-encoding:cc:content-type:from:subject:to;
 s=s1; bh=d/XQXB+zyoK5543jLJsjJXhpkelj1D3ArYEOINcbAGw=;
 b=HwgDXbm0mY3jVJUUarAUSZiMB1StmlzY8bQ+w4jKUObvD+R7z+OYMB6HgAM/UIt6ZJjj
 EBfBxhLc+P1VbHIK/W737BGwImBSjZ73C4tN/yIQ9xy2Rqtq67pz3+mhiiHsCojUEopnmp
 yws4haPMLfnSBVrVMHtOx0kdHT5b0mK15sJudHNrI/5W1PTa91j/jPsTwVJkKC0TfiiB2P
 ldJja1miSP8hShlzvlATtNwUAnJBL+69Hkda+ll7Vc0WZ0SqR1NtuI/Tka4VLGlyO0YFk9
 DydJ/FUDtU/zxmqRKPRzgQArF+0jbUUHEcsBQnifoVdCX2l+vnbPGJfq5ZIHSdnA==
Received: by filterdrecv-7765c6879f-kht5h with SMTP id
 filterdrecv-7765c6879f-kht5h-1-6501B2BF-13B
 2023-09-13 13:01:51.817695253 +0000 UTC m=+2930786.635545343
Received: from earth.catern.com (unknown) by geopod-ismtpd-18 (SG) with ESMTP
 id EtcvEPjlRyCQg-W_NcUgQw Wed, 13 Sep 2023 13:01:51.631 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=gnu.org 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id 5F4CE62523;
 Wed, 13 Sep 2023 09:01:51 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <83fs3int3t.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 13 Sep
 2023 15:41:10 +0300")
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
 <83fs3int3t.fsf@HIDDEN>
Date: Wed, 13 Sep 2023 13:01:51 +0000 (UTC)
Message-ID: <87msxqtef4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJsDIxVZAS6ctWFFVNKgH?=
 =?us-ascii?Q?SRQCZlJ0D1=2F8rM68qQhH0y14yTwRW3Q9XwioRuL?=
 =?us-ascii?Q?dGLnCq0vagagt31A3AVRTqxqQImWdimgqLKQWLi?=
 =?us-ascii?Q?N4UE3qCy64KoRDUxU42QT9FZ=2FL1FpreXTAolHPq?=
 =?us-ascii?Q?eb+V4RejUfPjv0LqBJa6CRmxoA2Huyu=2FCCQ=3D=3D?=
To: Eli Zaretskii <eliz@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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: Eli Zaretskii <eliz@HIDDEN> writes: >> From:
 sbaugh@HIDDEN
 >> Date: Wed, 13 Sep 2023 02:30:08 +0000 (UTC) >> >> This patch avoids the
 complicated scripting needed for >> emacsclient-mail.desktop by adding a
 new flag to emacsclient, [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
 bl.spamcop.net
 [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.126.143>]
 0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
 lines
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: sbaugh@HIDDEN
>> Date: Wed, 13 Sep 2023 02:30:08 +0000 (UTC)
>> 
>> This patch avoids the complicated scripting needed for
>> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall,
>> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be
>> basically the same as emacs-mail.desktop.
>> 
>> I expect this to also be useful in other places; the need to escape
>> arbitrary inputs before passing them to emacsclient is frequently
>> annoying.
>
> Is quoting the only issue with --eval?  If so, why not have a variant
> of --eval that quotes the argument by itself, like you do in the
> patch, i.e. by using quote_argument, instead of inventing yet another
> weird option with its own small DSL and extra-special rules of how to
> write the command line with it?

I am not sure what you're suggesting.  Can you show how the equivalent
of:

emacsclient --apply message-mailto -- %u

would work with that design?

> More generally, I cannot say I'm happy that we basically are
> reiterating everything that was said in bug#57752 instead of picking
> up where it left off.  Why is it useful to have another discussion
> like that one (which will probably end up at the same impasse)?

I admit I didn't see that bug until now, but the way in which this is
different is that I have now read the discussion, incorporated all the
advice, and I'm actually implementing it :)

Probably these bugs could/should be merged though.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 12:57:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 08:57:55 2023
Received: from localhost ([127.0.0.1]:32887 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgPRL-0001dD-3T
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 08:57:55 -0400
Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:42678)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-39fe-65902=debbugs.gnu.org@HIDDEN>)
 id 1qgPRH-0001cw-Jq
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 08:57:54 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:in-reply-to:references:mime-version:to:cc:content-type:
 cc:content-type:from:subject:to;
 s=s1; bh=IA/8zE8M8Z2Zq3Pn4wYU+nXEB9exsXj3Rl57w1CSpK0=;
 b=GDnambABtWZTPZ9e3eNGsazAV7y64tMwI9cHD5PfNgNa6O4gBvEiKYdpwvpqPLYeo/eH
 L5V/qqIUmF87OElxJZozd/3t/p1vPlhQw+7c5hyAKUcseB0vF45xzaNyp3pTCegrwnDtYz
 bJpX5R8SupspdDUPgzyAr11OvomQhLWHXZaeomhMJUM0+rpyAAStoIBXGuWMBH758e+ymG
 2NB7do9K47Mmrl/O4FCLGPOf/RT6lgZUoa5TrMudcJ1t5SHPmy1Q58Daz6wrWeZ1er08bV
 lhqnfa3AY8KCJvEq87f7XgPqynE7CiAdgdMuETUxokgnLtVgxTSYrkPggogBlQUw==
Received: by filterdrecv-8684c58db7-9pkkz with SMTP id
 filterdrecv-8684c58db7-9pkkz-1-6501B1C3-29
 2023-09-13 12:57:39.95744995 +0000 UTC m=+10847949.848089376
Received: from earth.catern.com (unknown) by geopod-ismtpd-1 (SG) with ESMTP
 id 3uFHoXEbQjiCQb4LueyrPw Wed, 13 Sep 2023 12:57:39.685 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=gmail.com 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id 3734F6566A;
 Wed, 13 Sep 2023 08:57:39 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <d796795f-7900-9140-8443-12f812cf8983@HIDDEN> (Jim Porter's
 message of "Tue, 12 Sep 2023 20:46:54 -0700")
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
 <d796795f-7900-9140-8443-12f812cf8983@HIDDEN>
Date: Wed, 13 Sep 2023 12:57:40 +0000 (UTC)
Message-ID: <87r0n2tem4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbK05RQBjAcJRehj6j96at?=
 =?us-ascii?Q?M0kLr7M+281RHp84Glohm29SWM2NtXD28eQ5+QH?=
 =?us-ascii?Q?KBJi=2FZCUFAj5htdyG8uwo2Zb+elErYm+hCJZra9?=
 =?us-ascii?Q?UDgxwDp8P0YBp1QaTR1=2FjcV2l44wKvqgRDzUxmh?=
 =?us-ascii?Q?pNZ4cIo2KQJ8cLSlYeHbpTuVbXaWT+Z=2FvKA=3D=3D?=
To: Jim Porter <jporterbugs@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 2.5 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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:  Jim Porter <jporterbugs@HIDDEN> writes: > On 9/12/2023
 7:30 PM, sbaugh@HIDDEN wrote: >> tags 65902 + patch >> quit >> This patch
 avoids the complicated scripting needed for >> emacsclient-mail.desktop by
 adding a new flag to emacsclient [...] 
 Content analysis details:   (2.5 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.3 RCVD_IN_VALIDITY_RPBL  RBL: Relay in Validity RPBL,
 https://senderscore.org/blocklistlookup/
 [149.72.154.232 listed in bl.score.senderscore.com]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
 bl.spamcop.net
 [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.154.232>]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [149.72.154.232 listed in wl.mailspike.net]
 0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
 lines
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.5 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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:  Jim Porter <jporterbugs@HIDDEN> writes: > On 9/12/2023
   7:30 PM, sbaugh@HIDDEN wrote: >> tags 65902 + patch >> quit >> This patch
    avoids the complicated scripting needed for >> emacsclient-mail.desktop by
    adding a new flag to emacsclient [...] 
 
 Content analysis details:   (1.5 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [149.72.154.232 listed in wl.mailspike.net]
  1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
                             bl.spamcop.net
              [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.154.232>]
  1.3 RCVD_IN_VALIDITY_RPBL  RBL: Relay in Validity RPBL,
                             https://senderscore.org/blocklistlookup/
                            [149.72.154.232 listed in bl.score.senderscore.com]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
                             lines
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

--=-=-=
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Jim Porter <jporterbugs@HIDDEN> writes:

> On 9/12/2023 7:30 PM, sbaugh@HIDDEN wrote:
>> tags 65902 + patch
>> quit
>> This patch avoids the complicated scripting needed for
>> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall,
>> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be
>> basically the same as emacs-mail.desktop.
>
> I think this is actually the same as the (very long) bug#57752, so
> thanks for working on this. (It was on my list of things to get to,
> but I just haven't had time.)
>
> Over there, we agreed that something like your patch is wanted, albeit
> with two caveats:
>
> 1. Since "--funcall" for the regular "emacs" binary doesn't pass
> arguments to the function, how about we call this option "--apply"
> instead?

Ah, for some reason I thought --funcall passed arguments.  Done in
attached patch.

> 2. It would be great if we could get "--apply" for the regular "emacs"
> binary too, so that both programs work the same way (at least in this
> regard).

Done.

Although the behavior is slightly different: emacs --apply calls the
function with subsequent FILE arguments, and emacsclient --apply calls
the function with all FILE arguments.  The "subsequent FILE arguments"
behavior is probably better, but I don't know a way to do that with
getopt (which emacsclient uses).

> Even better, if you could forward "--apply" from
> "emacsclient" to the alternate editor (which would be "emacs" 99% of
> the time) automatically. That works, in a roundabout way, for the
> Emacs daemon, but not if the alternate editor is "emacs".

This happens automatically anyway: When emacsclient starts the daemon,
it sends the --apply request.  I think that's exactly what you'd want.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Add-apply-argument-to-avoid-escaping-arguments.patch

From 4881017055ea6831ee7fe2d722eb79856946d907 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Tue, 12 Sep 2023 22:20:15 -0400
Subject: [PATCH] Add --apply argument to avoid escaping arguments

Passing arguments to functions through emacs --eval or emacsclient
--eval requires complicated escaping (as seen in
emacsclient-mail.desktop before this change).

The new --apply argument for both emacs and emacsclient passes command
line arguments as uninterpreted strings to the specified function.
This simplifies use cases where arbitrary input needs to be passed to
Emacs.

Note that there's a minor difference in behavior between emacs --apply
and emacsclient --apply: emacs --apply func calls func with only
command line arguments occuring after --apply, emacsclient --apply
func calls func with all command line arguments, even those which
occurred before --apply.  This is hard to avoid since emacsclient uses
getopt instead of fancier custom Lisp argument parsing in Emacs.

* etc/emacsclient-mail.desktop: Use --apply. (bug#65902)
* lib-src/emacsclient.c (longopts, decode_options, main): Add support
for --apply.
* lisp/server.el (server-apply-and-print): Add.
(server-process-filter): Add support for -apply and -applyargs
* lisp/startup.el (command-line-1): Add support for --apply.
* src/emacs.c (usage_message, standard_args): Add support for --apply.
---
 etc/emacsclient-mail.desktop |  9 +++------
 lib-src/emacsclient.c        | 36 ++++++++++++++++++++++++++++++++++--
 lisp/server.el               | 34 ++++++++++++++++++++++++++++++++++
 lisp/startup.el              | 18 +++++++++++++++---
 src/emacs.c                  |  3 +++
 5 files changed, 89 insertions(+), 11 deletions(-)

diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop
index 0a2420ddead..750fcddacdc 100644
--- a/etc/emacsclient-mail.desktop
+++ b/etc/emacsclient-mail.desktop
@@ -1,10 +1,7 @@
 [Desktop Entry]
 Categories=Network;Email;
 Comment=GNU Emacs is an extensible, customizable text editor - and more
-# We want to pass the following commands to the shell wrapper:
-# u=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")"
-# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'.
-Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u
+Exec=emacsclient --alternate-editor= --apply message-mailto -- %u
 Icon=emacs
 Name=Emacs (Mail, Client)
 MimeType=x-scheme-handler/mailto;
@@ -16,8 +13,8 @@ Actions=new-window;new-instance;
 
 [Desktop Action new-window]
 Name=New Window
-Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u
+Exec=emacsclient --alternate-editor= --create-frame --apply message-mailto -- %u
 
 [Desktop Action new-instance]
 Name=New Instance
-Exec=emacs -f message-mailto %u
+Exec=emacs --apply message-mailto -- %u
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 698bf9b50ae..159c22d1ae9 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -116,6 +116,9 @@ #define DEFAULT_TIMEOUT (30)
 /* True means args are expressions to be evaluated.  --eval.  */
 static bool eval;
 
+/* The function to call.  Other arguments are passed as strings.  --apply.  */
+static char *apply;
+
 /* True means open a new frame.  --create-frame etc.  */
 static bool create_frame;
 
@@ -169,6 +172,7 @@ #define DEFAULT_TIMEOUT (30)
   { "quiet",	no_argument,	   NULL, 'q' },
   { "suppress-output", no_argument, NULL, 'u' },
   { "eval",	no_argument,	   NULL, 'e' },
+  { "apply",	required_argument, NULL, 'y' },
   { "help",	no_argument,	   NULL, 'H' },
   { "version",	no_argument,	   NULL, 'V' },
   { "tty",	no_argument,       NULL, 't' },
@@ -552,6 +556,10 @@ decode_options (int argc, char **argv)
 	  eval = true;
 	  break;
 
+	case 'y':
+	  apply = optarg;
+	  break;
+
 	case 'q':
 	  quiet = true;
 	  break;
@@ -690,6 +698,7 @@ print_help_and_exit (void)
 -F ALIST, --frame-parameters=ALIST\n\
 			Set the parameters of a new frame\n\
 -e, --eval    		Evaluate the FILE arguments as ELisp expressions\n\
+-y, --apply FUNC	Call ELisp FUNC, passing all FILE arguments as strings\n\
 -n, --no-wait		Don't wait for the server to return\n\
 -w, --timeout=SECONDS	Seconds to wait before timing out\n\
 -q, --quiet		Don't display messages on success\n\
@@ -1953,7 +1962,7 @@ main (int argc, char **argv)
   /* Process options.  */
   decode_options (argc, argv);
 
-  if (! (optind < argc || eval || create_frame))
+  if (! (optind < argc || eval || apply || create_frame))
     {
       message (true, ("%s: file name or argument required\n"
 		      "Try '%s --help' for more information\n"),
@@ -1961,6 +1970,14 @@ main (int argc, char **argv)
       exit (EXIT_FAILURE);
     }
 
+  if (eval && apply)
+    {
+      message (true, ("%s: can't pass both --eval and --apply\n"
+		      "Try '%s --help' for more information\n"),
+	       progname, progname);
+      exit (EXIT_FAILURE);
+    }
+
 #ifdef SOCKETS_IN_FILE_SYSTEM
   if (tty)
     {
@@ -2080,6 +2097,13 @@ main (int argc, char **argv)
               send_to_emacs (emacs_socket, " ");
               continue;
             }
+	  else if (apply)
+	    {
+              send_to_emacs (emacs_socket, "-applyarg ");
+              quote_argument (emacs_socket, argv[i]);
+              send_to_emacs (emacs_socket, " ");
+              continue;
+	    }
 
 	  char *p = argv[i];
 	  if (*p == '+')
@@ -2136,10 +2160,18 @@ main (int argc, char **argv)
       send_to_emacs (emacs_socket, " ");
     }
 
+  if (apply)
+    {
+      send_to_emacs (emacs_socket, "-apply ");
+      quote_argument (emacs_socket, apply);
+      send_to_emacs (emacs_socket, " ");
+    }
+
+
   send_to_emacs (emacs_socket, "\n");
 
   /* Wait for an answer. */
-  if (!eval && !tty && !nowait && !quiet && 0 <= process_grouping ())
+  if (!eval && !apply && !tty && !nowait && !quiet && 0 <= process_grouping ())
     {
       printf ("Waiting for Emacs...");
       skiplf = false;
diff --git a/lisp/server.el b/lisp/server.el
index c3325e5a24c..5981e90625d 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -873,6 +873,17 @@ server-eval-and-print
                        (point-min) (point-max))))
             (server-reply-print (server-quote-arg text) proc)))))))
 
+(defun server-apply-and-print (func args proc)
+  "Call FUNC on ARGS and send the result back to client PROC."
+  (let ((v (with-local-quit (eval (apply (intern func) args) t))))
+    (when proc
+      (with-temp-buffer
+        (let ((standard-output (current-buffer)))
+          (pp v)
+          (let ((text (buffer-substring-no-properties
+                       (point-min) (point-max))))
+            (server-reply-print (server-quote-arg text) proc)))))))
+
 (defconst server-msg-size 1024
   "Maximum size of a message sent to a client.")
 
@@ -1196,6 +1207,7 @@ server-process-filter
 		tty-type   ; string.
 		files
 		filepos
+		applyargs
 		args-left)
 	    ;; Remove this line from STRING.
 	    (setq string (substring string (match-end 0)))
@@ -1323,6 +1335,28 @@ server-process-filter
                          commands)
                    (setq filepos nil)))
 
+                ;; -apply FUNC:  Call a function on arguments.
+                ("-apply"
+                 (if use-current-frame
+                     (setq use-current-frame 'always))
+                 (let ((func (pop args-left)))
+                   (if coding-system
+                       (setq func (decode-coding-string func coding-system)))
+                   (push (lambda () (server-apply-and-print func applyargs proc))
+                         commands)
+                   (setq applyargs nil)
+                   (setq filepos nil)))
+
+                ;; -applyarg ARG:  Add an argument for later -apply.
+                ("-applyarg"
+                 (if use-current-frame
+                     (setq use-current-frame 'always))
+                 (let ((arg (pop args-left)))
+                   (if coding-system
+                       (setq arg (decode-coding-string arg coding-system)))
+                   (push arg applyargs)
+                   (setq filepos nil)))
+
                 ;; -env NAME=VALUE:  An environment variable.
                 ("-env"
                  (let ((var (pop args-left)))
diff --git a/lisp/startup.el b/lisp/startup.el
index 7f601668369..bb8da76bdf1 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2531,10 +2531,11 @@ command-line-1
                ;; straight away upon any --directory/-L option.
                splice
                just-files ;; t if this follows the magic -- option.
+               applysym applyargs ;; function and arguments for --apply
                ;; This includes our standard options' long versions
                ;; and long versions of what's on command-switch-alist.
                (longopts
-                (append '("--funcall" "--load" "--insert" "--kill"
+                (append '("--funcall" "--apply" "--load" "--insert" "--kill"
                           "--dump-file" "--seccomp"
                           "--directory" "--eval" "--execute" "--no-splash"
                           "--find-file" "--visit" "--file" "--no-desktop")
@@ -2632,6 +2633,11 @@ command-line-1
                          (command-execute tem)
                        (funcall tem)))
 
+                    ((member argi '("-y" "-apply"))
+                     (setq inhibit-startup-screen t)
+                     ;; Subsequent file args will be accumulated into applyargs.
+                     (setq applysym (intern (or argval (pop command-line-args-left)))))
+
                     ((member argi '("-eval" "-execute"))
                      (setq inhibit-startup-screen t)
                      (let* ((str-expr (or argval (pop command-line-args-left)))
@@ -2763,13 +2769,19 @@ command-line-1
                          ;; screen for -nw?
                          (unless initial-window-system
                            (setq inhibit-startup-screen t))
-                         (funcall process-file-arg orig-argi)))))
+                         (if applysym
+                             (push orig-argi applyargs)
+                           (funcall process-file-arg orig-argi))))))
 
               ;; In unusual circumstances, the execution of Lisp code due
               ;; to command-line options can cause the last visible frame
               ;; to be deleted.  In this case, kill emacs to avoid an
               ;; abort later.
-              (unless (frame-live-p (selected-frame)) (kill-emacs nil)))))))
+              (unless (frame-live-p (selected-frame)) (kill-emacs nil))))
+
+          ;; Call the function specified with --apply, if any.
+          (when applysym
+            (apply applysym (nreverse applyargs))))))
 
     (when (eq initial-buffer-choice t)
       ;; When `initial-buffer-choice' equals t make sure that *scratch*
diff --git a/src/emacs.c b/src/emacs.c
index 80a013b68df..8de40936250 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -323,6 +323,8 @@ #define MAIN_PROGRAM
 --file FILE             visit FILE\n\
 --find-file FILE        visit FILE\n\
 --funcall, -f FUNC      call Emacs Lisp function FUNC with no arguments\n\
+--apply, -y FUNC        call Emacs Lisp function FUNC, passing\n\
+                          subsequent positional FILE arguments as strings\n\
 --insert FILE           insert contents of FILE into current buffer\n\
 --kill                  exit without asking for confirmation\n\
 --load, -l FILE         load Emacs Lisp FILE using the load function\n\
@@ -2648,6 +2650,7 @@ main (int argc, char **argv)
      option.  In any case, this is entirely an internal option.  */
   { "-scriptload", NULL, 0, 1 },
   { "-f", "--funcall", 0, 1 },
+  { "-y", "--apply", 0, 1 },
   { "-funcall", 0, 0, 1 },
   { "-eval", "--eval", 0, 1 },
   { "-execute", "--execute", 0, 1 },
-- 
2.41.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 12:42:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 08:42:13 2023
Received: from localhost ([127.0.0.1]:32875 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgPC8-00073A-UJ
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 08:42:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:44542)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgPC7-00072w-EG
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 08:42:11 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgPBw-0007IP-Px; Wed, 13 Sep 2023 08:42:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=igVt/CkB7sj/V6HV3fzap9x6fsFrq6v3ogBh9bLEItc=; b=eiLTHhjqbbVQ
 Y6MpTnB/db5+8jd+rdzuhFE9SMFxcOiePEU9yfKQ4wp30ZOqyGYKjFD2SLNxYfaZ7R1dJwnH5Bw2U
 G+9MxFypceAEiqqq9tB+kzwgZI+ePVOJtNx34qPzXAnWZOYgYHQxL/w7bR1+QPwHDTWGMxdhDcVMX
 suq2rUaq8sbUz4J9OOG0+yVEoJuw8v9PrnuRykd7jkII2jLumEjdiOdqQ2NcMHX5PatR/ORbnIOzC
 C+oEVe7bpGqzbw7uidcr5wQKvPS86TN5FTggg5kYxcp4BOlN5JTfxJfmNiL+qXYyq6akNZ505MmUN
 Igny3fS/UQ6WWInSogalQQ==;
Date: Wed, 13 Sep 2023 15:41:48 +0300
Message-Id: <83edj2nt2r.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <d796795f-7900-9140-8443-12f812cf8983@HIDDEN> (message from
 Jim Porter on Tue, 12 Sep 2023 20:46:54 -0700)
Subject: Re: bug#65902: 29.0.92;
 emacsclient-mail.desktop fails due to complicated escaping
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
 <d796795f-7900-9140-8443-12f812cf8983@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 12 Sep 2023 20:46:54 -0700
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> On 9/12/2023 7:30 PM, sbaugh@HIDDEN wrote:
> > tags 65902 + patch
> > quit
> > 
> > This patch avoids the complicated scripting needed for
> > emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall,
> > which mirrors emacs --funcall and allows emacsclient-mail.desktop to be
> > basically the same as emacs-mail.desktop.
> 
> I think this is actually the same as the (very long) bug#57752, so 
> thanks for working on this. (It was on my list of things to get to, but 
> I just haven't had time.)
> 
> Over there, we agreed that something like your patch is wanted, albeit 
> with two caveats:
> 
> 1. Since "--funcall" for the regular "emacs" binary doesn't pass 
> arguments to the function, how about we call this option "--apply" instead?
> 
> 2. It would be great if we could get "--apply" for the regular "emacs" 
> binary too, so that both programs work the same way (at least in this 
> regard). Even better, if you could forward "--apply" from "emacsclient" 
> to the alternate editor (which would be "emacs" 99% of the time) 
> automatically. That works, in a roundabout way, for the Emacs daemon, 
> but not if the alternate editor is "emacs".

This is how that bug's discussion started.  Are we going to have it
all one more time?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 12:41:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 08:41:34 2023
Received: from localhost ([127.0.0.1]:32866 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgPBW-00071S-IO
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 08:41:34 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49206)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qgPBU-00071G-So
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 08:41:34 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qgPBK-0007D0-2f; Wed, 13 Sep 2023 08:41:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=v4lN26fQLkJh8me+5Z3njqz9SrwklSYjbGCWvgj0aF8=; b=FPlIceSHgsbS
 jfthhY2VWirkZGoHsjFoVlwtRDQgx6Ecfcl5jfi5f8/XQX10ds6OnrYk3EQu6J1zKI/KSJPOc8RlH
 EIg0zYD30xE3kdgdqcJA88P4nzn2TE6aB0V8CpxIwreNicpiMYg4fVrfGk4D+6b9q6Jv5zRTGg7Iq
 FSYtGoDd6nDjuEamBAau6wXQqeUB8hdKwrwwHoozfDjt+kdb18/8c8hX+cMfdMylFdSP3ZdfqBGxf
 U2Wgzpdg4AyBc4LgaJB1wtIsguK9pBv/MIX1XK66pxHzpVkpgtkBbRwdkf6tlDgLoF8x4Z8G8eWZk
 uprisk7Tf7OvEs/JxpwFXA==;
Date: Wed, 13 Sep 2023 15:41:10 +0300
Message-Id: <83fs3int3t.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: sbaugh@HIDDEN
In-Reply-To: <87v8ceu7o0.fsf@HIDDEN> (sbaugh@HIDDEN)
Subject: Re: bug#65902: 29.0.92;
 emacsclient-mail.desktop fails due to complicated escaping
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65902
Cc: 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: sbaugh@HIDDEN
> Date: Wed, 13 Sep 2023 02:30:08 +0000 (UTC)
> 
> This patch avoids the complicated scripting needed for
> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall,
> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be
> basically the same as emacs-mail.desktop.
> 
> I expect this to also be useful in other places; the need to escape
> arbitrary inputs before passing them to emacsclient is frequently
> annoying.

Is quoting the only issue with --eval?  If so, why not have a variant
of --eval that quotes the argument by itself, like you do in the
patch, i.e. by using quote_argument, instead of inventing yet another
weird option with its own small DSL and extra-special rules of how to
write the command line with it?

More generally, I cannot say I'm happy that we basically are
reiterating everything that was said in bug#57752 instead of picking
up where it left off.  Why is it useful to have another discussion
like that one (which will probably end up at the same impasse)?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 08:00:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 04:00:27 2023
Received: from localhost ([127.0.0.1]:60666 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgKnT-0002eb-1o
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 04:00:27 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:46178)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1qgKnG-0002eB-Me
 for 65902 <at> debbugs.gnu.org; Wed, 13 Sep 2023 04:00:25 -0400
Received: by mail-wr1-x432.google.com with SMTP id
 ffacd0b85a97d-31fc91d5ca6so265454f8f.0
 for <65902 <at> debbugs.gnu.org>; Wed, 13 Sep 2023 01:00:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1694592003; x=1695196803; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=Dd9slT/Rl/0RXRos/fgAxJbltRwpjIojAYJfY5xTTBY=;
 b=YOjpiqQkYL5LOMrJBmyPPd7hkn+7jI52LLSuLVi9NpFH+v/3uaNTSxXjTaX+FSGE6Q
 wJA2uQNadGm8sX+6bXtIbrXJ6zd/wCRlgRjyO3FDqTZTesiX2WFDp6oa44g4vKb0DmEt
 Cw3/qCjegUcxjoqzjY06dHZ6Ksa0lf2ZFRBLLA27/3RIUBTV1fJjO6q8aLbsHykh7m+A
 SMNzqaU8O8Ui0NXNhi09TUMHBOdYQFG4gGuA3nX/cIztDYXTd7LKlmusXlwXWNZZ6V5p
 vp75cuMqgALfpXxjXKDJfJhl1O0Yw8uUEMryk57F61AKUzmIk87ZuQ6DBD58B0HWa2Js
 S0Xw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1694592003; x=1695196803;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=Dd9slT/Rl/0RXRos/fgAxJbltRwpjIojAYJfY5xTTBY=;
 b=mnL1lh3uXylEEzxqq+NTmTGOicsKEpTxaSQpXwWWI0lXKkrkSvEIsvb2ob0Kcu0agH
 /bk1el5vxf7x1U5kC2ts8tT8e5TjolGrXX3ibTSvoWQytpNvH5L5GZH0QpDh/W6gkj2F
 pLwiXbdKL8k1QWcn5D0zBXenDYKh8TIAKXUIsDIg2WkV4nVjKKb8SVhZk4Yv41bGwZxx
 ZiZ2E0L7D16Mc5oN+69+GykYP2vVjlJgi5elPcFOon9NC/FMspKj27vQiRgEjkjShesQ
 ZT9ocIZ0O4EWQOG6M0O3utJ+QTVrxuXjNGEV0Mo+TKmhzw9l4Eb85wpRIzBZm42AkmpY
 XvBQ==
X-Gm-Message-State: AOJu0Yy19y5cpzwA/rrfN3OfMazny4Zq5m+T6ISleDK295RybkXa9Xzi
 TXFgX5SVKrieZ9O3mMvRvvOodCTuBpdkqQ==
X-Google-Smtp-Source: AGHT+IHZL3XTK391ekYMzD+n9huGsp8yF51rdX2nkr3SW/kkT0poBGyzSnTlyTsxiZw7Mellz7lCig==
X-Received: by 2002:adf:fe8c:0:b0:31f:9bdb:79fc with SMTP id
 l12-20020adffe8c000000b0031f9bdb79fcmr1350639wrr.31.1694592002914; 
 Wed, 13 Sep 2023 01:00:02 -0700 (PDT)
Received: from rltb ([2a01:e0a:3f3:fb50:9eeb:e8ff:fe1b:1ad8])
 by smtp.gmail.com with ESMTPSA id
 u4-20020a5d6da4000000b0031fb91f23e9sm3874504wrs.43.2023.09.13.01.00.01
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 13 Sep 2023 01:00:01 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <d796795f-7900-9140-8443-12f812cf8983@HIDDEN> (Jim Porter's
 message of "Tue, 12 Sep 2023 20:46:54 -0700")
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
 <d796795f-7900-9140-8443-12f812cf8983@HIDDEN>
Date: Wed, 13 Sep 2023 10:00:00 +0200
Message-ID: <87edj2ec5b.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
Cc: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> On Tue, 12 Sep 2023 20:46:54 -0700, Jim Porter <jporterbugs@HIDDEN> said:

    Jim> On 9/12/2023 7:30 PM, sbaugh@HIDDEN wrote:
    >> tags 65902 + patch
    >> quit
    >> This patch avoids the complicated scripting needed for
    >> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall,
    >> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be
    >> basically the same as emacs-mail.desktop.

    Jim> I think this is actually the same as the (very long) bug#57752, so
    Jim> thanks for working on this. (It was on my list of things to get to,
    Jim> but I just haven't had time.)

57752 got bogged down in design paralysis :-)

The idea looks good to me.

    Jim> Over there, we agreed that something like your patch is wanted, albeit
    Jim> with two caveats:

    Jim> 1. Since "--funcall" for the regular "emacs" binary doesn't pass
    Jim> arguments to the function, how about we call this option "--apply"
    Jim> instead?

Yes, that sounds right.

    Jim> 2. It would be great if we could get "--apply" for the regular "emacs"
    Jim> binary too, so that both programs work the same way (at least in this
    Jim> regard). Even better, if you could forward "--apply" from
    Jim> "emacsclient" to the alternate editor (which would be "emacs" 99% of
    Jim> the time) automatically. That works, in a roundabout way, for the
    Jim> Emacs daemon, but not if the alternate editor is "emacs".

Consistency would be good here.

Robert
-- 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 03:47:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 12 23:47:26 2023
Received: from localhost ([127.0.0.1]:60447 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgGqN-0004a2-56
	for submit <at> debbugs.gnu.org; Tue, 12 Sep 2023 23:47:26 -0400
Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:48531)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1qgGqJ-0004ZZ-8j
 for 65902 <at> debbugs.gnu.org; Tue, 12 Sep 2023 23:47:08 -0400
Received: by mail-pf1-x42d.google.com with SMTP id
 d2e1a72fcca58-68a3ced3ec6so5609887b3a.1
 for <65902 <at> debbugs.gnu.org>; Tue, 12 Sep 2023 20:47:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1694576816; x=1695181616; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:content-language
 :references:to:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=8r0h3+iKa5ZcKRXM0yIotnlWhK6cEFFjVVZcJASXtGg=;
 b=HFLe2tFm7CoWXa7PbrCt/ubJ2N14aPg9iic8C6CH+9wvfjxJcl4kVNqDt/p7m+qwZD
 7Qn9wuoIuQkC0fmZXoUknSnqxqRu/f1fz9IjaJzwWsRygm9Zqn89pDas9somGMq1iCbt
 gVIyfBNgIXlfXJ56+sUCeQf6GVGnoDlIYJ9VsNQfcf5LM40EgPuNge3vUMMrtOwaKqEa
 x1Q+/hUoOC4YZa78bz/CXg3qmgvzxnz8iW3BehtRu4J9jPd5/lZGN6DwIWPlgVQtpD+G
 pZf+h72dkyxK28i9bHTtPPn9isztLLVJS659SFX92dUjGvSSpXFHXs82VqBJBSef35n0
 Ul1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1694576816; x=1695181616;
 h=content-transfer-encoding:in-reply-to:from:content-language
 :references:to:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=8r0h3+iKa5ZcKRXM0yIotnlWhK6cEFFjVVZcJASXtGg=;
 b=qBH4tjzZnCCsEGJ6ScU6qqVk+DQt4+1jxFzRBCYb9GEOTrBZP/SBTya0Ta7hfO+suD
 8iclti31+VVZRM2rT6aT8a79WLlgKJgwMBUIkB0/qVuj/ZENF5e8aW8/D2dXNJqRm6ha
 8paTG2wvwl/cGUAcRiKqZQXFsn/4MzxLDvddIQ3rOgmkMOd7U4Lqqx39nmXHknSfWElg
 V6HvR6Sd2Pc8D6mwA9HPN5ismgFZAX6UyEnplvKJf9cZIBm1/9UL7yG5epUPrAfsmueC
 KZMIInT+R4+vUtJgf+qt8ihredhgJwMP72/KNFiW0E1B0Y7bOC3IAe4BdHymJJiOdBfA
 bhlw==
X-Gm-Message-State: AOJu0YyMdtTDefCFs1IMoYR6psahXHxvtYLhF7iCFl7OxSTKcwXHPjKd
 GNG3BCrArL7KnN/cnqhHIGk=
X-Google-Smtp-Source: AGHT+IFS4ncrJyQIrNY64Bevs6dCWQb2hRfpvvmjR5Av2VV2rCckw6iy1wKqtzuA7T2EaAhK0FtwNg==
X-Received: by 2002:a05:6a20:4324:b0:156:9c45:bf30 with SMTP id
 h36-20020a056a20432400b001569c45bf30mr1475120pzk.53.1694576816171; 
 Tue, 12 Sep 2023 20:46:56 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id
 h4-20020a170902f54400b001b8c689060dsm9285425plf.28.2023.09.12.20.46.54
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Tue, 12 Sep 2023 20:46:55 -0700 (PDT)
Message-ID: <d796795f-7900-9140-8443-12f812cf8983@HIDDEN>
Date: Tue, 12 Sep 2023 20:46:54 -0700
MIME-Version: 1.0
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
To: sbaugh@HIDDEN, 65902 <at> debbugs.gnu.org
References: <871qf2vmi4.fsf@HIDDEN> <87v8ceu7o0.fsf@HIDDEN>
Content-Language: en-US
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <87v8ceu7o0.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 9/12/2023 7:30 PM, sbaugh@HIDDEN wrote:
> tags 65902 + patch
> quit
> 
> This patch avoids the complicated scripting needed for
> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall,
> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be
> basically the same as emacs-mail.desktop.

I think this is actually the same as the (very long) bug#57752, so 
thanks for working on this. (It was on my list of things to get to, but 
I just haven't had time.)

Over there, we agreed that something like your patch is wanted, albeit 
with two caveats:

1. Since "--funcall" for the regular "emacs" binary doesn't pass 
arguments to the function, how about we call this option "--apply" instead?

2. It would be great if we could get "--apply" for the regular "emacs" 
binary too, so that both programs work the same way (at least in this 
regard). Even better, if you could forward "--apply" from "emacsclient" 
to the alternate editor (which would be "emacs" 99% of the time) 
automatically. That works, in a roundabout way, for the Emacs daemon, 
but not if the alternate editor is "emacs".




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.
Added tag(s) patch. Request was from sbaugh@HIDDEN to control <at> debbugs.gnu.org. Full text available.

Message received at 65902 <at> debbugs.gnu.org:


Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 02:30:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 12 22:30:26 2023
Received: from localhost ([127.0.0.1]:60417 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgFe5-0008LY-Dw
	for submit <at> debbugs.gnu.org; Tue, 12 Sep 2023 22:30:25 -0400
Received: from s.wfbtzhsv.outbound-mail.sendgrid.net ([159.183.224.104]:28810)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-39fe-65902=debbugs.gnu.org@HIDDEN>)
 id 1qgFe0-0008L2-Pd
 for 65902 <at> debbugs.gnu.org; Tue, 12 Sep 2023 22:30:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:in-reply-to:references:mime-version:to:content-type:cc:
 content-type:from:subject:to;
 s=s1; bh=ezrooZthfeKLIZmlQWNKH3PwgULf5uR0Ly6cTSrcCwo=;
 b=ouySX6E9PvVrLS2RbwEvDz4t5aRRv65Yr/WyFPiZw/xQeSiNjxhRrOI4b95BTHLXYSD5
 iRrdGBgcbV3cSXis+lxTUhRsy8AjC0vCHRAxzMXAfJCK8pkMYEU75ND0xX9du2mRni5wGc
 tJGA0FcZjgnyLDiMw0+IbhRaMavu29WpV2dfs8mjKV/lMqFcj6mNwBsBLMxDldMTHdX0yH
 +x/v2RyAe1eS8At9YzlS+3msu0zBF0qbQ6TX0nd54yFBfS0glcvwfERN68fAV5b2FZbvGD
 +rPZc6nZr019l69qpndijFruNnTNOdFMs3S/z9KQqX6lG8+W10oAOXvFvjo4023g==
Received: by filterdrecv-7765c6879f-k58xv with SMTP id
 filterdrecv-7765c6879f-k58xv-1-65011EB0-6
 2023-09-13 02:30:08.059200673 +0000 UTC m=+2892946.207112839
Received: from earth.catern.com (unknown) by geopod-ismtpd-28 (SG) with ESMTP
 id 2L1baOyrSvu-Pq0rNjY-Ig Wed, 13 Sep 2023 02:30:07.855 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=debbugs.gnu.org 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id 686B460105;
 Tue, 12 Sep 2023 22:30:07 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to
 complicated escaping
In-Reply-To: <871qf2vmi4.fsf@HIDDEN> (sbaugh@HIDDEN's message of "Wed, 
 13 Sep 2023 02:24:20 +0000 (UTC)")
References: <871qf2vmi4.fsf@HIDDEN>
Date: Wed, 13 Sep 2023 02:30:08 +0000 (UTC)
Message-ID: <87v8ceu7o0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbKxr19SAD9NJYU1Ku8aAG?=
 =?us-ascii?Q?CFUMWKaDOWr+YZ9dhHmLDMgTtXKW3akTp2WNkZ0?=
 =?us-ascii?Q?aunVw0DB3I7wGVUA4jPyisIsPVyMe7plinQlroK?=
 =?us-ascii?Q?ybsT9ftJmWFZ+rulY6nO7jaTGBD=2FGVx7atB7Yb9?=
 =?us-ascii?Q?3yp=2FANnuCemkcOJTPkoDDSP13r09GqBajkg=3D=3D?=
To: 65902 <at> debbugs.gnu.org
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65902
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

tags 65902 + patch
quit

This patch avoids the complicated scripting needed for
emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall,
which mirrors emacs --funcall and allows emacsclient-mail.desktop to be
basically the same as emacs-mail.desktop.

I expect this to also be useful in other places; the need to escape
arbitrary inputs before passing them to emacsclient is frequently
annoying.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Add-funcall-to-emacsclient-to-avoid-escaping-argumen.patch

From 6c9dbda3aa5e3f1e3a5003bc0a15cf662b880d99 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Tue, 12 Sep 2023 22:20:15 -0400
Subject: [PATCH] Add --funcall to emacsclient to avoid escaping arguments

Passing arguments to functions through emacsclient --eval requires
complicated escaping (as seen in emacsclient-mail.desktop before this
change).  The new --funcall argument behaves like emacs -f, and just
passes the arguments as uninterpreted strings to the specified
function.  This simplifies use cases where arbitrary input needs to be
passed to emacsclient.

* etc/emacsclient-mail.desktop: Use --funcall. (bug#65902)
* lib-src/emacsclient.c (longopts, decode_options, main): Add support
for --funcall.
* lisp/server.el (server-funcall-and-print): Add.
(server-process-filter):  Add support for -funcall and -funcallargs
---
 etc/emacsclient-mail.desktop |  7 ++-----
 lib-src/emacsclient.c        | 36 ++++++++++++++++++++++++++++++++++--
 lisp/server.el               | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 7 deletions(-)

diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop
index 0a2420ddead..fc6773a963b 100644
--- a/etc/emacsclient-mail.desktop
+++ b/etc/emacsclient-mail.desktop
@@ -1,10 +1,7 @@
 [Desktop Entry]
 Categories=Network;Email;
 Comment=GNU Emacs is an extensible, customizable text editor - and more
-# We want to pass the following commands to the shell wrapper:
-# u=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")"
-# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'.
-Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u
+Exec=emacsclient --alternate-editor= --funcall message-mailto %u
 Icon=emacs
 Name=Emacs (Mail, Client)
 MimeType=x-scheme-handler/mailto;
@@ -16,7 +13,7 @@ Actions=new-window;new-instance;
 
 [Desktop Action new-window]
 Name=New Window
-Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u
+Exec=emacsclient --alternate-editor= --create-frame --funcall message-mailto %u
 
 [Desktop Action new-instance]
 Name=New Instance
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 698bf9b50ae..5bf6c05ef37 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -116,6 +116,9 @@ #define DEFAULT_TIMEOUT (30)
 /* True means args are expressions to be evaluated.  --eval.  */
 static bool eval;
 
+/* The function to call.  Other arguments are passed as strings.  --funcall.  */
+static char *funcall;
+
 /* True means open a new frame.  --create-frame etc.  */
 static bool create_frame;
 
@@ -169,6 +172,7 @@ #define DEFAULT_TIMEOUT (30)
   { "quiet",	no_argument,	   NULL, 'q' },
   { "suppress-output", no_argument, NULL, 'u' },
   { "eval",	no_argument,	   NULL, 'e' },
+  { "funcall",	required_argument, NULL, 'l' },
   { "help",	no_argument,	   NULL, 'H' },
   { "version",	no_argument,	   NULL, 'V' },
   { "tty",	no_argument,       NULL, 't' },
@@ -552,6 +556,10 @@ decode_options (int argc, char **argv)
 	  eval = true;
 	  break;
 
+	case 'l':
+	  funcall = optarg;
+	  break;
+
 	case 'q':
 	  quiet = true;
 	  break;
@@ -690,6 +698,7 @@ print_help_and_exit (void)
 -F ALIST, --frame-parameters=ALIST\n\
 			Set the parameters of a new frame\n\
 -e, --eval    		Evaluate the FILE arguments as ELisp expressions\n\
+-l, --funcall FUNC	Call ELisp FUNC, passing FILE arguments as strings\n\
 -n, --no-wait		Don't wait for the server to return\n\
 -w, --timeout=SECONDS	Seconds to wait before timing out\n\
 -q, --quiet		Don't display messages on success\n\
@@ -1953,7 +1962,7 @@ main (int argc, char **argv)
   /* Process options.  */
   decode_options (argc, argv);
 
-  if (! (optind < argc || eval || create_frame))
+  if (! (optind < argc || eval || funcall || create_frame))
     {
       message (true, ("%s: file name or argument required\n"
 		      "Try '%s --help' for more information\n"),
@@ -1961,6 +1970,14 @@ main (int argc, char **argv)
       exit (EXIT_FAILURE);
     }
 
+  if (eval && funcall)
+    {
+      message (true, ("%s: can't pass both --eval and --funcall\n"
+		      "Try '%s --help' for more information\n"),
+	       progname, progname);
+      exit (EXIT_FAILURE);
+    }
+
 #ifdef SOCKETS_IN_FILE_SYSTEM
   if (tty)
     {
@@ -2080,6 +2097,13 @@ main (int argc, char **argv)
               send_to_emacs (emacs_socket, " ");
               continue;
             }
+	  else if (funcall)
+	    {
+              send_to_emacs (emacs_socket, "-funcallarg ");
+              quote_argument (emacs_socket, argv[i]);
+              send_to_emacs (emacs_socket, " ");
+              continue;
+	    }
 
 	  char *p = argv[i];
 	  if (*p == '+')
@@ -2136,10 +2160,18 @@ main (int argc, char **argv)
       send_to_emacs (emacs_socket, " ");
     }
 
+  if (funcall)
+    {
+      send_to_emacs (emacs_socket, "-funcall ");
+      quote_argument (emacs_socket, funcall);
+      send_to_emacs (emacs_socket, " ");
+    }
+
+
   send_to_emacs (emacs_socket, "\n");
 
   /* Wait for an answer. */
-  if (!eval && !tty && !nowait && !quiet && 0 <= process_grouping ())
+  if (!eval && !funcall && !tty && !nowait && !quiet && 0 <= process_grouping ())
     {
       printf ("Waiting for Emacs...");
       skiplf = false;
diff --git a/lisp/server.el b/lisp/server.el
index c3325e5a24c..da3319581ea 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -873,6 +873,17 @@ server-eval-and-print
                        (point-min) (point-max))))
             (server-reply-print (server-quote-arg text) proc)))))))
 
+(defun server-funcall-and-print (func args proc)
+  "Call FUNC on ARGS and send the result back to client PROC."
+  (let ((v (with-local-quit (eval (apply (intern func) args) t))))
+    (when proc
+      (with-temp-buffer
+        (let ((standard-output (current-buffer)))
+          (pp v)
+          (let ((text (buffer-substring-no-properties
+                       (point-min) (point-max))))
+            (server-reply-print (server-quote-arg text) proc)))))))
+
 (defconst server-msg-size 1024
   "Maximum size of a message sent to a client.")
 
@@ -1196,6 +1207,7 @@ server-process-filter
 		tty-type   ; string.
 		files
 		filepos
+		funcallargs
 		args-left)
 	    ;; Remove this line from STRING.
 	    (setq string (substring string (match-end 0)))
@@ -1323,6 +1335,28 @@ server-process-filter
                          commands)
                    (setq filepos nil)))
 
+                ;; -funcall FUNC:  Call a function on arguments.
+                ("-funcall"
+                 (if use-current-frame
+                     (setq use-current-frame 'always))
+                 (let ((func (pop args-left)))
+                   (if coding-system
+                       (setq func (decode-coding-string func coding-system)))
+                   (push (lambda () (server-funcall-and-print func funcallargs proc))
+                         commands)
+                   (setq funcallargs nil)
+                   (setq filepos nil)))
+
+                ;; -funcallarg ARG:  Add an argument for later -funcall.
+                ("-funcallarg"
+                 (if use-current-frame
+                     (setq use-current-frame 'always))
+                 (let ((arg (pop args-left)))
+                   (if coding-system
+                       (setq arg (decode-coding-string arg coding-system)))
+                   (push arg funcallargs)
+                   (setq filepos nil)))
+
                 ;; -env NAME=VALUE:  An environment variable.
                 ("-env"
                  (let ((var (pop args-left)))
-- 
2.41.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 Sep 2023 02:24:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 12 22:24:42 2023
Received: from localhost ([127.0.0.1]:60395 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgFYX-0008As-C0
	for submit <at> debbugs.gnu.org; Tue, 12 Sep 2023 22:24:42 -0400
Received: from lists.gnu.org ([2001:470:142::17]:58296)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-3678-bug-gnu-emacs=gnu.org@HIDDEN>)
 id 1qgFYS-0008Ae-OA
 for submit <at> debbugs.gnu.org; Tue, 12 Sep 2023 22:24:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from
 <bounces+21787432-3678-bug-gnu-emacs=gnu.org@HIDDEN>)
 id 1qgFYI-0004bd-E7
 for bug-gnu-emacs@HIDDEN; Tue, 12 Sep 2023 22:24:26 -0400
Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from
 <bounces+21787432-3678-bug-gnu-emacs=gnu.org@HIDDEN>)
 id 1qgFYF-0002eF-Gj
 for bug-gnu-emacs@HIDDEN; Tue, 12 Sep 2023 22:24:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:mime-version:to:content-type:content-transfer-encoding:
 cc:content-type:from:subject:to;
 s=s1; bh=7+nMK057e/Bq9DoDE7uv4qRUxuDi4QuAP1EKfGEJEBY=;
 b=WbzBa6s8GPcWwIK3WL+yZASMkXz8P1gD7ZnEqJKkjeYYF5mHORzwuahZZ2Yt61IaUF2C
 shhRNX14pAH4YWM0+yXrEnn9acQ/P96PSDttOcFsk+1LTv1Ayng5Egge9QJZEKRcfPFjdT
 N4GqOoGQlgREMJ5GZQ4V750vjSC2bT2hTidhq88HjejEsDoJHWAneHYbQDDf4InTkNlM9P
 lI53ksir7qKLIWrlIgaTYhk13hCUDdoY6pVmT9b8t7wl5Y6To2GtXOUjhz19ZokR80qyPh
 Up4PCOg1vpP9wL93ZRtUvgWppY+pDRnTTrzXJnn2IkgokLrHghna/W9+l4anWvSQ==
Received: by filterdrecv-canary-6695df9f56-dwxq4 with SMTP id
 filterdrecv-canary-6695df9f56-dwxq4-1-65011D54-10
 2023-09-13 02:24:20.809477446 +0000 UTC m=+10809956.203441843
Received: from earth.catern.com (unknown) by geopod-ismtpd-4 (SG) with ESMTP
 id FYxEy5YXQdK2EVpQC7TMQg for <bug-gnu-emacs@HIDDEN>;
 Wed, 13 Sep 2023 02:24:20.584 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=gnu.org 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id C46C560129
 for <bug-gnu-emacs@HIDDEN>; Tue, 12 Sep 2023 22:24:19 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping
Date: Wed, 13 Sep 2023 02:24:20 +0000 (UTC)
Message-ID: <871qf2vmi4.fsf@HIDDEN>
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbIq2yG8CYjCabLjQokKWv?=
 =?us-ascii?Q?045nHdOWLJcBTnKe+KbokBe022QH+hTboOlE1l7?=
 =?us-ascii?Q?KXXuVRtQec8TFwMzmxiCj9IV8OHTHT1JsoC1Tdd?=
 =?us-ascii?Q?D7gyXTXF92Y9KU9X=2FCr6=2FMYy+qZyRSUxmNzhZGC?=
 =?us-ascii?Q?t5cbV+SFhXpS03ROthy2FDWlFYjIvTrks0kWQ55?=
 =?us-ascii?Q?IakBTA4fULNrutXFI=3D?=
To: bug-gnu-emacs@HIDDEN
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=149.72.126.143;
 envelope-from=bounces+21787432-3678-bug-gnu-emacs=gnu.org@HIDDEN;
 helo=s.wrqvtzvf.outbound-mail.sendgrid.net
X-Spam_score_int: -7
X-Spam_score: -0.8
X-Spam_bar: /
X-Spam_report: (-0.8 / 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,
 RCVD_IN_BL_SPAMCOP_NET=1.347, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 2.2 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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:  The emacsclient-mail.desktop file fails on my system with
 the following error: "$1": -c: line 2: unexpected EOF while looking for
 matching
 `)' My subsequent mail will fix this also vastly simplify
 emacsclient-mail.desktop
 by adding a new feature to emacsclient to avoid the need for complex escaping.
 Content analysis details:   (2.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
 bl.spamcop.net
 [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.126.143>]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
 lines
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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:  The emacsclient-mail.desktop file fails on my system with
   the following error: "$1": -c: line 2: unexpected EOF while looking for matching
    `)' My subsequent mail will fix this also vastly simplify emacsclient-mail.desktop
    by adding a new feature to emacsclient to avoid the need for complex escaping.
    
 
 Content analysis details:   (1.2 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
                             bl.spamcop.net
              [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.126.143>]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
  0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
                             lines
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager


The emacsclient-mail.desktop file fails on my system with the following
error:
"$1": -c: line 2: unexpected EOF while looking for matching `)'

My subsequent mail will fix this also vastly simplify
emacsclient-mail.desktop by adding a new feature to emacsclient to avoid
the need for complex escaping.


In GNU Emacs 29.0.92 (build 68, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2023-07-15 built on earth
Repository revision: 36d3460f9f6064c03fd88e0c969c8e4f4d645235
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: NixOS 23.05 (Stoat)

Configured using:
 'configure --cache-file=3Dconfig.cache --with-x-toolkit=3Dlucid
 --with-tree-sitter --with-xinput2 CC=3Dgcc PKG_CONFIG=3Dpkg-config
 PKG_CONFIG_PATH=3D/nix/store/s3r15m8wbl4wqk4khqlf41ikryhjm1bi-file-5.44-de=
v/lib/pkgconfig:/nix/store/f9jbn419h46c78z1pi49yn9a8742b0ql-gnutls-3.8.0-de=
v/lib/pkgconfig:/nix/store/knq0pv08wm4dins7m4jh0n7cv7pjvdjr-nettle-3.9.1-de=
v/lib/pkgconfig:/nix/store/dy8p07vrrhdgpnl45xz9c0k0didbikdh-gmp-with-cxx-6.=
2.1-dev/lib/pkgconfig:/nix/store/6hkdabzyqhyq5ypq4c9b2cibr1d1zg1s-harfbuzz-=
7.3.0-dev/lib/pkgconfig:/nix/store/hyns944pqgblw4icskylvlpm5krmfvcr-graphit=
e2-1.3.14-dev/lib/pkgconfig:/nix/store/08cdp9vgvy023ysfa2y01gzsm2jv6phx-jan=
sson-2.14/lib/pkgconfig:/nix/store/nqlbk40lh7igs61l77dwgdkn8dc2akcm-libxml2=
-2.10.4-dev/lib/pkgconfig:/nix/store/b3axl73v3yvqqx7g47njqb5wzxvm280p-zlib-=
1.2.13-dev/lib/pkgconfig:/nix/store/3f2rc4inlcxmq11718qmz94v2rpybw70-ncurse=
s-6.4-dev/lib/pkgconfig:/nix/store/bxy745kyb1fwhpfkiaaz3wgvpkpvwcpq-dbus-1.=
14.8-dev/lib/pkgconfig:/nix/store/9714v7c4cgpm4yqcyqk6n9xw9iq3a1bs-expat-2.=
5.0-dev/lib/pkgconfig:/nix/store/zzi7pcadidqh798yddxv6pwdbwpkikma-libselinu=
x-3.3-dev/lib/pkgconfig:/nix/store/w14j7y5nl14vy4ikcivss35jmrqq3fxj-libotf-=
0.9.16-dev/lib/pkgconfig:/nix/store/arhk7hsch4scyv6m24fw03yq6wq5wbbx-m17n-l=
ib-1.8.2/lib/pkgconfig:/nix/store/1jbbrny8xcjb68lb5m30cvxycfkyhvsv-sqlite-3=
.42.0-dev/lib/pkgconfig:/nix/store/5vx779yqkxaysv48gicwlgv0ippbrhc4-systemd=
-253.5-dev/lib/pkgconfig:/nix/store/5vx779yqkxaysv48gicwlgv0ippbrhc4-system=
d-253.5-dev/share/pkgconfig:/nix/store/djifahvk3qp06ssqxv6gy1ixdnnypr9s-tre=
e-sitter-0.20.8/lib/pkgconfig:/nix/store/74aasy1d2r5y27zn68cs1rxwy1llzn05-l=
ibwebp-1.3.0/lib/pkgconfig:/nix/store/8sk7bp89iwb4gw96fq6xakb6lcy2x52n-Xaw3=
d-1.6.3/lib/pkgconfig:/nix/store/ppvb3ha8148am3ajnzxnm6i3ri38c01n-libXmu-1.=
1.3-dev/lib/pkgconfig:/nix/store/jyxf8cjbj3nzh00x48nfram79i63chdi-libX11-1.=
8.6-dev/lib/pkgconfig:/nix/store/zk9v0nr5zdfi1ybkhcfifmxsng7hfl23-xorgproto=
-2021.5/share/pkgconfig:/nix/store/3q1k18v8aa6mxs538bha4ry0mp3m321l-libxcb-=
1.14-dev/lib/pkgconfig:/nix/store/hcscz68zvfk1skyb25wrnha959f6hhrc-libXt-1.=
2.1-dev/lib/pkgconfig:/nix/store/kl55wj6qc3v481jsgvzm5w2csnhm84zf-libSM-1.2=
.3-dev/lib/pkgconfig:/nix/store/s3f67kvsn55rxp2rc98xv0hkq364yci1-libICE-1.0=
.10-dev/lib/pkgconfig:/nix/store/rsw4ri8025jgln8vpsrmg82bzgbcw3zr-cairo-1.1=
6.0-dev/lib/pkgconfig:/nix/store/jir0rqbcy0d9qr9kf5cwf2yphql4ykyw-fontconfi=
g-2.14.2-dev/lib/pkgconfig:/nix/store/n2g3xblaz1k4civv1z6hhm1nsmp3m17p-free=
type-2.13.0-dev/lib/pkgconfig:/nix/store/isbmyzm2shmp0wsjr4cy45v2i58h2zvw-b=
zip2-1.0.8-dev/lib/pkgconfig:/nix/store/bl2qwy78jr2sqm260imgxmd5dzhjqvag-br=
otli-1.0.9-dev/lib/pkgconfig:/nix/store/z96jh9ag5b3565lwwb5chjb9bfp5i2qv-li=
bpng-apng-1.6.39-dev/lib/pkgconfig:/nix/store/jjd4z18grhky6lh8n463v648nnf56=
28b-pixman-0.42.2/lib/pkgconfig:/nix/store/qd14wrazwcspjv3q65vgh35pl7b8nifq=
-libXext-1.3.4-dev/lib/pkgconfig:/nix/store/gj8i21xx87ip9b971j2d1m0rmrzyhbi=
r-libXau-1.0.9-dev/lib/pkgconfig:/nix/store/4gpinwwdqhi927xkrfpr1hvdd56baxg=
k-libXrender-0.9.10-dev/lib/pkgconfig:/nix/store/d1jbygs6hcn6dysk706i9zf07y=
d18wmr-xcb-util-0.4.1-dev/lib/pkgconfig:/nix/store/hdc4ika0mb1cv0cf6dchwxbr=
004rc50i-glib-2.76.3-dev/lib/pkgconfig:/nix/store/wxyh848a6xcqy2v8727vcwspr=
i53pqwi-libffi-3.4.4-dev/lib/pkgconfig:/nix/store/42jx72681qzliic0xsjhvx24c=
il2gapk-libGL-1.6.0-dev/lib/pkgconfig:/nix/store/b9lmdkxpvgkj6zc956fvhshzis=
qpi767-libglvnd-1.6.0-dev/lib/pkgconfig:/nix/store/gff29sbhg1gcw969mpm5rb69=
3kj5v18w-libXaw-1.0.14-dev/lib/pkgconfig:/nix/store/776xijk8rsb1b4c0dsxwq0k=
82bvm7mm9-libXpm-3.5.15-dev/lib/pkgconfig:/nix/store/qizdmm43xi65mdngal8bpb=
pqcdc8290d-libjpeg-turbo-2.1.5.1-dev/lib/pkgconfig:/nix/store/db7ix62fx4nvr=
9j1fjdvnznl2npff4pr-librsvg-2.55.1-dev/lib/pkgconfig:/nix/store/q0hg0951w1d=
v9y40m9ggln8phwil6lxc-gdk-pixbuf-2.42.10-dev/lib/pkgconfig:/nix/store/34rr5=
nvgljsc4bi3mxjxg8abmjr1f7hn-libtiff-4.5.0-dev/lib/pkgconfig:/nix/store/zwkr=
4kjcjs213pw9mhzi46bzlw6qwxzq-libdeflate-1.18/lib/pkgconfig:/nix/store/6na55=
2yzwml88j8g5vqf5h9ir3vw8myi-xz-5.4.3-dev/lib/pkgconfig
 CXX=3Dg++'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Diff

Minor modes in effect:
  whitespace-mode: t
  envrc-global-mode: t
  envrc-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  windmove-mode: t
  pixel-scroll-precision-mode: t
  savehist-mode: t
  save-place-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/sbaugh/.emacs.d/elpa/transient-0.3.7/transient hides /home/sbaugh/src=
/emacs/emacs-29/lisp/transient

Features:
(shadow sort emacsbug mpv tq org-timer org-clock org org-macro
org-pcomplete org-list org-footnote org-faces org-entities ob-python
python compat ob ob-tangle org-src ob-ref ob-lob ob-table ob-exp
ob-comint ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs cal-menu calendar cal-loaddefs
org-version org-compat org-macs vc-src vc-sccs vc-svn vc-cvs vc-rcs gud
noutline outline debug backtrace shortdoc pcmpl-unix pcmpl-gnu misc
pulse color compile etags fileloop generator xref cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
bug-reference find-func cl-print help-fns radix-tree mail-extr rng-xsd
xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse
nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode
nxml-outln nxml-rap sgml-mode facemenu dom nxml-util nxml-enc xmltok
whitespace log-view vc conf-mode dabbrev tabify man mule-util jka-compr
tramp-cmds misearch multi-isearch vc-hg vc-bzr nix-mode nix-repl
nix-shell nix-store nix-log nix-instantiate nix-shebang nix-format nix
tramp-cache time-stamp tramp-sh tramp tramp-loaddefs trampver
tramp-integration tramp-compat parse-time iso8601 cus-start vc-git
vc-dispatcher dired-aux dired-x ffap sh-script smie treesit executable
project files-x face-remap exwm-randr xcb-randr exwm exwm-input
xcb-keysyms xcb-xkb exwm-manage exwm-floating xcb-cursor xcb-render
exwm-layout exwm-workspace exwm-core xcb-ewmh xcb-icccm xcb xcb-xproto
xcb-types xcb-debug lui-autopaste circe advice lui-irc-colors irc gnutls
lcs lui-logging lui-format lui tracking shorten thingatpt flyspell
ispell circe-compat agda2 envrc inheritenv page-ext magit-extras
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func imenu
magit-diff smerge-mode diff diff-mode git-commit rx log-edit message
sendmail yank-media puny dired desktop frameset dired-loaddefs rfc822
mml mml-sec epa derived epg rfc6068 epg-config gnus-util
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
mail-utils gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor shell pcomplete comint ansi-osc server
ansi-color magit-mode transient cl-extra edmacro kmacro help-mode
format-spec magit-git magit-section magit-utils crm dash windmove
easy-mmode pixel-scroll cua-base ring modus-vivendi-theme modus-themes
pcase cus-edit pp cus-load icons wid-edit savehist saveplace finder-inf
ace-window-autoloads auctex-autoloads tex-site avy-autoloads
circe-autoloads corfu-autoloads compat-autoloads csv-mode-autoloads
cyberpunk-theme-autoloads debbugs-autoloads eat-autoloads
envrc-autoloads exwm-autoloads ggtags-autoloads
graphviz-dot-mode-autoloads htmlize-autoloads inheritenv-autoloads
magit-autoloads git-commit-autoloads markdown-mode-autoloads
mastodon-autoloads mentor-autoloads async-autoloads mpv-autoloads
nix-mode-autoloads magit-section-autoloads dash-autoloads
notmuch-autoloads persist-autoloads request-autoloads
rust-mode-autoloads transient-autoloads url-scgi-autoloads
vundo-autoloads which-key-autoloads info with-editor-autoloads
xelb-autoloads xml-rpc-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo x-toolkit x multi-tty make-network-process
emacs)

Memory information:
((conses 16 793112 58580)
 (symbols 48 42890 0)
 (strings 32 165901 6428)
 (string-bytes 1 8295556)
 (vectors 16 90751)
 (vector-slots 8 2007121 64111)
 (floats 8 418 578)
 (intervals 56 43463 2379)
 (buffers 984 111))




Acknowledgement sent to sbaugh@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#65902; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 14 Sep 2023 15:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.