| 1 |
|
# Copyright 1999-2023 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
|
NEED_EMACS=28
|
| 6 |
|
|
| 7 |
|
inherit elisp desktop xdg-utils
|
| 8 |
5 |
|
| 9 |
6 |
DESCRIPTION="Desktop entries for handling mailto URIs with GNU Emacs"
|
| 10 |
7 |
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Emacs"
|
| 11 |
|
S="${WORKDIR}"
|
| 12 |
8 |
|
| 13 |
|
LICENSE="GPL-2+"
|
|
9 |
LICENSE="metapackage"
|
| 14 |
10 |
SLOT="0"
|
| 15 |
11 |
KEYWORDS="~amd64 ~x86"
|
| 16 |
12 |
|
| 17 |
|
src_compile() { :; }
|
| 18 |
|
|
| 19 |
|
src_install() {
|
| 20 |
|
newmenu - emacs-mail.desktop <<-EOF
|
| 21 |
|
[Desktop Entry]
|
| 22 |
|
Type=Application
|
| 23 |
|
Name=GNU Emacs (mail)
|
| 24 |
|
NoDisplay=true
|
| 25 |
|
Exec=${EPREXIX}/usr/bin/emacs -f message-mailto %u
|
| 26 |
|
Terminal=false
|
| 27 |
|
MimeType=x-scheme-handler/mailto;
|
| 28 |
|
EOF
|
| 29 |
|
|
| 30 |
|
# The Desktop Entry Specification does not allow field codes like %u
|
| 31 |
|
# inside a quoted argument, therefore we need a shell wrapper.
|
| 32 |
|
# We pass the following commands to it, in order to backslash-escape
|
| 33 |
|
# any special characters '\' and '"' that occur in %u:
|
| 34 |
|
# u=${1//\\/\\\\}
|
| 35 |
|
# u=${u//\"/\\\"}
|
| 36 |
|
# exec emacsclient --eval "(message-mailto \"$u\")"
|
| 37 |
|
# However, in the desktop entry '"', '\', and '$' must be escaped
|
| 38 |
|
# as '\\"', '\\\\', and '\\$', respectively. Yet another level of
|
| 39 |
|
# backslash escapes is needed for '\' and '$' in the here-document.
|
| 40 |
|
newmenu - emacsclient-mail.desktop <<-EOF
|
| 41 |
|
[Desktop Entry]
|
| 42 |
|
Type=Application
|
| 43 |
|
Name=Emacsclient (mail)
|
| 44 |
|
NoDisplay=true
|
| 45 |
|
Exec=${EPREFIX}/bin/bash -c \
|
| 46 |
|
"u=\\\\\${1//\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\}; \
|
| 47 |
|
u=\\\\\${u//\\\\\\\\\\\\"/\\\\\\\\\\\\\\\\\\\\\\\\\\\\"}; \
|
| 48 |
|
exec ${EPREFIX}/usr/bin/emacsclient \
|
| 49 |
|
--eval \\\\"(message-mailto \\\\\\\\\\\\"\\\\\$u\\\\\\\\\\\\")\\\\"" bash %u
|
| 50 |
|
Terminal=false
|
| 51 |
|
MimeType=x-scheme-handler/mailto;
|
| 52 |
|
EOF
|
| 53 |
|
}
|
|
13 |
RDEPEND=">=app-editors/emacs-30.1:*
|
|
14 |
>=app-emacs/emacs-common-1.14[gui]"
|
| 54 |
15 |
|
| 55 |
16 |
pkg_postinst() {
|
| 56 |
|
xdg_desktop_database_update
|
| 57 |
|
}
|
| 58 |
|
|
| 59 |
|
pkg_postrm() {
|
| 60 |
|
xdg_desktop_database_update
|
|
17 |
ewarn "Desktop entries handling mailto URIs (with Emacs 30.1 or later)"
|
|
18 |
ewarn "are now installed by >=app-emacs/emacs-common-1.14."
|
|
19 |
ewarn "${CATEGORY}/${PN} is deprecated and no longer installs"
|
|
20 |
ewarn "any files, so you may safely unmerge it."
|
| 61 |
21 |
}
|