From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Cassou Newsgroups: gmane.emacs.bugs Subject: bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me Date: Mon, 12 Sep 2022 20:31:27 +0200 Message-ID: <87r10gcum8.fsf@cassou.me> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24980"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Peter Oliver To: 57752@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 12 20:32:50 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oXoEj-0006KY-Sq for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Sep 2022 20:32:49 +0200 Original-Received: from localhost ([::1]:58586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXoEi-0002IL-DG for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Sep 2022 14:32:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXoEE-0002HZ-Dv for bug-gnu-emacs@gnu.org; Mon, 12 Sep 2022 14:32:19 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXoDy-0008HJ-EX for bug-gnu-emacs@gnu.org; Mon, 12 Sep 2022 14:32:17 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oXoDx-0007G6-Vr for bug-gnu-emacs@gnu.org; Mon, 12 Sep 2022 14:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Damien Cassou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Sep 2022 18:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57752 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166300750627873 (code B ref -1); Mon, 12 Sep 2022 18:32:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Sep 2022 18:31:46 +0000 Original-Received: from localhost ([127.0.0.1]:47837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXoDg-0007FS-Fv for submit@debbugs.gnu.org; Mon, 12 Sep 2022 14:31:46 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:52308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXoDZ-0007FF-S3 for submit@debbugs.gnu.org; Mon, 12 Sep 2022 14:31:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXoDZ-00021B-CB for bug-gnu-emacs@gnu.org; Mon, 12 Sep 2022 14:31:37 -0400 Original-Received: from mail.choca.pics ([2001:910:1410:500::1]:48094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXoDW-0008Dq-QS for bug-gnu-emacs@gnu.org; Mon, 12 Sep 2022 14:31:36 -0400 Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id E7F62181942A3; Mon, 12 Sep 2022 20:31:29 +0200 (CEST) Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id 48tgsv_wiMOy; Mon, 12 Sep 2022 20:31:29 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 2715A181942A2; Mon, 12 Sep 2022 20:31:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at choca.pics Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id mjF5xZeAOygW; Mon, 12 Sep 2022 20:31:28 +0200 (CEST) Original-Received: from localhost (153.226.95.79.rev.sfr.net [79.95.226.153]) by mail.choca.pics (Postfix) with ESMTPSA id C3F9C181929F6; Mon, 12 Sep 2022 20:31:28 +0200 (CEST) Received-SPF: pass client-ip=2001:910:1410:500::1; envelope-from=damien@cassou.me; helo=mail.choca.pics X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:242295 Archived-At: 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