* [gentoo-commits] repo/gentoo:master commit in: x11-misc/emacs-desktop-mail/
@ 2022-12-16 18:05 Ulrich Müller
0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Müller @ 2022-12-16 18:05 UTC (permalink / raw
To: gentoo-commits
commit: e7c3de949b9565006c50eebcc50fdf9f66791fb5
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 16 18:03:16 2022 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Dec 16 18:05:12 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7c3de94
x11-misc/emacs-desktop-mail: Initial import
Ebuild contributed by me.
Closes: https://bugs.gentoo.org/885981
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
.../emacs-desktop-mail-1.0.ebuild | 53 ++++++++++++++++++++++
x11-misc/emacs-desktop-mail/metadata.xml | 9 ++++
2 files changed, 62 insertions(+)
diff --git a/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.0.ebuild b/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.0.ebuild
new file mode 100644
index 000000000000..07495faea5b4
--- /dev/null
+++ b/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.0.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+NEED_EMACS=28
+
+inherit elisp desktop xdg-utils
+
+DESCRIPTION="Desktop entries for handling mailto URIs with GNU Emacs"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Emacs"
+S="${WORKDIR}"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+src_compile() { :; }
+
+src_install() {
+ newmenu - emacs-mail.desktop <<-EOF
+ [Desktop Entry]
+ Type=Application
+ Name=GNU Emacs (mail)
+ NoDisplay=true
+ Exec=${EPREXIX}/usr/bin/emacs -f message-mailto %u
+ Terminal=false
+ MimeType=x-scheme-handler/mailto;
+ EOF
+
+ newmenu - emacsclient-mail.desktop <<-EOF
+ [Desktop Entry]
+ Type=Application
+ Name=Emacsclient (mail)
+ NoDisplay=true
+ Exec=${EPREFIX}/usr/libexec/emacs/emacsclient-mail-wrapper.sh %u
+ Terminal=false
+ MimeType=x-scheme-handler/mailto;
+ EOF
+
+ exeinto /usr/libexec/emacs
+ newexe - emacsclient-mail-wrapper.sh <<-EOF
+ #!${EPREXIX}/bin/bash
+ exec ${EPREFIX}/usr/bin/emacsclient --eval "(message-mailto \\"\$1\\")"
+ EOF
+}
+
+pkg_postinst() {
+ xdg_desktop_database_update
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/x11-misc/emacs-desktop-mail/metadata.xml b/x11-misc/emacs-desktop-mail/metadata.xml
new file mode 100644
index 000000000000..986088003fe1
--- /dev/null
+++ b/x11-misc/emacs-desktop-mail/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>gnu-emacs@gentoo.org</email>
+ <name>Gentoo GNU Emacs project</name>
+</maintainer>
+<stabilize-allarches/>
+</pkgmetadata>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: x11-misc/emacs-desktop-mail/
@ 2022-12-17 7:49 Ulrich Müller
0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Müller @ 2022-12-17 7:49 UTC (permalink / raw
To: gentoo-commits
commit: 6caef5feb18d261c4a1c99444dc46028c68a8d9a
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 17 07:46:36 2022 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Dec 17 07:48:58 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6caef5fe
x11-misc/emacs-desktop-mail: Inline the wrapper shell script
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
...ktop-mail-1.0.ebuild => emacs-desktop-mail-1.1.ebuild} | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.0.ebuild b/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild
similarity index 61%
rename from x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.0.ebuild
rename to x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild
index 07495faea5b4..92d93860fb2f 100644
--- a/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.0.ebuild
+++ b/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild
@@ -27,21 +27,22 @@ src_install() {
MimeType=x-scheme-handler/mailto;
EOF
+ # 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
+ # as '\\"', '\\\\', and '\\$', respectively. Yet another level of
+ # backslash escapes is needed for '\' and '$' in the here-document.
newmenu - emacsclient-mail.desktop <<-EOF
[Desktop Entry]
Type=Application
Name=Emacsclient (mail)
NoDisplay=true
- Exec=${EPREFIX}/usr/libexec/emacs/emacsclient-mail-wrapper.sh %u
+ Exec=${EPREFIX}/bin/bash -c "exec ${EPREFIX}/usr/bin/emacsclient \
+--eval \\\\"(message-mailto \\\\\\\\\\\\"\\\\\$1\\\\\\\\\\\\")\\\\"" bash %u
Terminal=false
MimeType=x-scheme-handler/mailto;
EOF
-
- exeinto /usr/libexec/emacs
- newexe - emacsclient-mail-wrapper.sh <<-EOF
- #!${EPREXIX}/bin/bash
- exec ${EPREFIX}/usr/bin/emacsclient --eval "(message-mailto \\"\$1\\")"
- EOF
}
pkg_postinst() {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: x11-misc/emacs-desktop-mail/
@ 2023-03-07 17:28 Ulrich Müller
0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Müller @ 2023-03-07 17:28 UTC (permalink / raw
To: gentoo-commits
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-07 17:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-07 17:28 [gentoo-commits] repo/gentoo:master commit in: x11-misc/emacs-desktop-mail/ Ulrich Müller
-- strict thread matches above, loose matches on Subject: below --
2022-12-17 7:49 Ulrich Müller
2022-12-16 18:05 Ulrich Müller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox