From: Damien Cassou <damien@cassou.me>
To: 57752@debbugs.gnu.org
Cc: Peter Oliver <git@mavit.org.uk>
Subject: bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me
Date: Mon, 12 Sep 2022 20:31:27 +0200 [thread overview]
Message-ID: <87r10gcum8.fsf@cassou.me> (raw)
Hi,
The file emacsclient-mail.desktop that is provided by Emacs (see below
for an excerpt) doesn't seem to work for me. I would like mailto: links
in the web browser to open with emacsclient but nothing happens. How to
reproduce:
1. start the Emacs daemon (if not already done)
2. go to
https://lists.gnu.org/archive/html/emacs-devel/2022-09/msg00320.html in
a non-Emacs web browser
3. click the "Eli Zaretskii" button after "reply via email to"
Expected: An Emacs client frame appears with a buffer in message mode
Actual: Nothing happens
If you try to reproduce and you get a different application opening to
compose your email, you might want to add the following to
~/.config/mimeapps.list:
[Default Applications]
x-scheme-handler/mailto=emacsclient-mail.desktop
It feels like launching my web browser from the terminal sometimes makes
it work, but that's not really reliable.
The freedesktop Desktop Entry Specification [1] contains:
Field codes must not be used inside a quoted argument, the result of
field code expansion inside a quoted argument is undefined.
It seems to me that the .desktop file Emacs provides does just that: use
a field code (%u) inside a quoted argument. I might be wrong in the
interpretation of the spec though as the next sentence in the spec seems
to contradict this interpretation.
Anyway, I found a way to always have it working:
1. create a file emacs-compose-email.sh that starts emacsclient
2. add the executable bit to the file
3. reference the shell script from emacsclient-mail.desktop
See below for the script and .desktop file. Another advantage of this
approach is that the desktop file becomes much simpler with much less
backslashes.
My question is: do you want a patch with this change?
emacs-compose-email.sh:
#!/usr/bin/env bash
emacsclient --alternate-editor= --eval "(message-mailto \"$1\")"
Working emacsclient-mail.desktop:
[Desktop Entry]
Exec=emacs-compose-email.sh %u
MimeType=x-scheme-handler/mailto
Name=Emacs (Mail, Client)
NoDisplay=true
Terminal=false
Type=Application
Version=1.4
Excerpt of the existing (non-working) emacsclient-mail.desktop:
[Desktop Entry]
Exec=sh -c "exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\\\(message-mailto\\\\ \\\\\\"%u\\\\\\"\\\\)"
Name=Emacs (Mail, Client)
MimeType=x-scheme-handler/mailto;
Actions=new-window;new-instance;
[Desktop Action new-window]
Name=New Window
Exec=emacsclient --alternate-editor= --create-frame --eval "(message-mailto \\"%u\\")"
[Desktop Action new-instance]
Name=New Instance
Exec=emacs -f message-mailto %u
[1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
--
Damien Cassou
"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
next reply other threads:[~2022-09-12 18:31 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-12 18:31 Damien Cassou [this message]
2022-09-13 12:19 ` bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me Lars Ingebrigtsen
2022-09-13 13:29 ` Damien Cassou
2022-09-13 13:41 ` Eli Zaretskii
2022-09-13 13:58 ` Damien Cassou
2022-09-13 14:57 ` Robert Pluim
2022-09-13 15:32 ` Damien Cassou
2022-09-15 18:30 ` Jim Porter
2022-09-16 9:54 ` Lars Ingebrigtsen
2022-09-16 10:09 ` Robert Pluim
2022-09-16 10:14 ` Lars Ingebrigtsen
2022-09-16 14:18 ` Robert Pluim
2022-09-16 15:21 ` Jim Porter
2022-09-16 12:38 ` Damien Cassou
2022-09-16 12:50 ` Gregory Heytings
2022-09-16 14:46 ` Damien Cassou
2022-09-16 15:07 ` Gregory Heytings
2022-09-16 16:18 ` Peter Oliver
2022-09-16 16:42 ` Gregory Heytings
2022-09-16 17:21 ` Jim Porter
2022-09-16 18:26 ` Gregory Heytings
2022-09-16 19:33 ` Jim Porter
2022-09-16 20:04 ` Gregory Heytings
2022-09-18 13:58 ` Robert Pluim
2022-09-16 14:19 ` Robert Pluim
2022-09-16 14:47 ` Damien Cassou
2022-09-16 15:17 ` Jim Porter
2022-09-18 10:23 ` Lars Ingebrigtsen
2022-09-18 14:46 ` Robert Pluim
2022-09-19 8:09 ` Lars Ingebrigtsen
2022-09-18 18:31 ` Jim Porter
2022-09-19 8:12 ` Lars Ingebrigtsen
2022-09-19 15:48 ` Jim Porter
2022-09-19 18:45 ` Lars Ingebrigtsen
2022-09-19 8:56 ` Gregory Heytings
2022-09-19 12:00 ` Lars Ingebrigtsen
2022-09-19 16:05 ` Jim Porter
2022-09-19 17:01 ` Gregory Heytings
2022-12-02 14:52 ` Max Nikulin
2023-07-26 5:14 ` Max Nikulin
2022-09-16 19:42 ` Jim Porter
2022-09-18 10:26 ` Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r10gcum8.fsf@cassou.me \
--to=damien@cassou.me \
--cc=57752@debbugs.gnu.org \
--cc=git@mavit.org.uk \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).