public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-misc/emacs-desktop-mail/
Date: Tue,  7 Mar 2023 17:28:21 +0000 (UTC)	[thread overview]
Message-ID: <1678210008.0f29d9f2912573e696b9cb6019cb036246d7d21e.ulm@gentoo> (raw)

commit:     0f29d9f2912573e696b9cb6019cb036246d7d21e
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  7 17:26:48 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Mar  7 17:26:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f29d9f2

x11-misc/emacs-desktop-mail: Backslash-escape '\' and '"'

Escape any backslash and double quote characters, before passing the URI
to emacsclient.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 ...op-mail-1.1.ebuild => emacs-desktop-mail-1.2.ebuild} | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild b/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.2.ebuild
similarity index 65%
rename from x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild
rename to x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.2.ebuild
index 92d93860fb2f..aa83394f2032 100644
--- a/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild
+++ b/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -29,8 +29,12 @@ src_install() {
 
 	# The Desktop Entry Specification does not allow field codes like %u
 	# inside a quoted argument, therefore we need a shell wrapper.
-	# We want to pass a literal '"(message-mailto \"$1\")"' in the -c
-	# command, but in the desktop entry '"', '\', and '$' must be escaped
+	# We pass the following commands to it, in order to backslash-escape
+	# any special characters '\' and '"' that occur in %u:
+	#   u=${1//\\/\\\\}
+	#   u=${u//\"/\\\"}
+	#   exec emacsclient --eval "(message-mailto \"$u\")"
+	# However, in the desktop entry '"', '\', and '$' must be escaped
 	# as '\\"', '\\\\', and '\\$', respectively. Yet another level of
 	# backslash escapes is needed for '\' and '$' in the here-document.
 	newmenu - emacsclient-mail.desktop <<-EOF
@@ -38,8 +42,11 @@ src_install() {
 		Type=Application
 		Name=Emacsclient (mail)
 		NoDisplay=true
-		Exec=${EPREFIX}/bin/bash -c "exec ${EPREFIX}/usr/bin/emacsclient \
---eval \\\\"(message-mailto \\\\\\\\\\\\"\\\\\$1\\\\\\\\\\\\")\\\\"" bash %u
+		Exec=${EPREFIX}/bin/bash -c \
+"u=\\\\\${1//\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\}; \
+u=\\\\\${u//\\\\\\\\\\\\"/\\\\\\\\\\\\\\\\\\\\\\\\\\\\"}; \
+exec ${EPREFIX}/usr/bin/emacsclient \
+--eval \\\\"(message-mailto \\\\\\\\\\\\"\\\\\$u\\\\\\\\\\\\")\\\\"" bash %u
 		Terminal=false
 		MimeType=x-scheme-handler/mailto;
 	EOF


             reply	other threads:[~2023-03-07 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 17:28 Ulrich Müller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-12-17  7:49 [gentoo-commits] repo/gentoo:master commit in: x11-misc/emacs-desktop-mail/ Ulrich Müller
2022-12-16 18:05 Ulrich Müller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1678210008.0f29d9f2912573e696b9cb6019cb036246d7d21e.ulm@gentoo \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox