unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49292: Improvements to emacs-mail.desktop
@ 2021-06-30 14:07 Peter Oliver
       [not found] ` <handler.49292.B.162506205713309.ack@debbugs.gnu.org>
  2021-07-02 11:09 ` bug#49292: Improvements to emacs-mail.desktop Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Oliver @ 2021-06-30 14:07 UTC (permalink / raw)
  To: 49292

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

Attached are three patches to improve emacs-mail.desktop, which is new in Emacs 28:

- Provide an emacsclient-mail.desktop, for consistency with emacsclient.desktop.
- Install emacs-mail.desktop and emacsclient-mail.desktop.
- Hide emacs-mail.desktop, emacsclient-mail.desktop from menus.

-- 
Peter Oliver

[-- Attachment #2: Type: text/plain, Size: 3130 bytes --]

From 22a63ad477b530e225b1dcb535076ec045486afa Mon Sep 17 00:00:00 2001
From: Peter Oliver <git@mavit.org.uk>
Date: Wed, 9 Jun 2021 12:44:32 +0100
Subject: [PATCH 1/3] Provide an emacsclient-mail.desktop
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We provide both an emacs.desktop and an emacsclient.desktop, so for
consistency let’s do the same with mail.

* etc/emacs-mail.desktop: Extract suggestions for using emacsclient
from comments to create emacsclient-mail.desktop.
* etc/emacsclient-mail.desktop: Send mail using an existing Emacs
rather than starting a new one.
---
 etc/NEWS                     |  1 +
 etc/emacs-mail.desktop       | 14 +-------------
 etc/emacsclient-mail.desktop | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+), 13 deletions(-)
 create mode 100644 etc/emacsclient-mail.desktop

diff --git a/etc/NEWS b/etc/NEWS
index 701b9a73a8..3106bb1bed 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1073,6 +1073,7 @@ Clicking on a 'mailto:' link in other applications will then open
 Emacs with headers filled out according to the link, e.g.
 "mailto:larsi@gnus.org?subject=This+is+a+test".  If you prefer
 emacsclient, use "emacsclient -e '(message-mailto "%u")'"
+or "emacsclient-mail.desktop".
 
 ---
 *** Change to default value of 'message-draft-headers' user option.
diff --git a/etc/emacs-mail.desktop b/etc/emacs-mail.desktop
index 251afa100c..3a96b9ec8c 100644
--- a/etc/emacs-mail.desktop
+++ b/etc/emacs-mail.desktop
@@ -1,22 +1,10 @@
 [Desktop Entry]
 Categories=Network;Email;
 Comment=GNU Emacs is an extensible, customizable text editor - and more
+Exec=emacs -f message-mailto %u
 Icon=emacs
 Name=Emacs (Mail)
 MimeType=x-scheme-handler/mailto;
 NoDisplay=false
 Terminal=false
 Type=Application
-
-Exec=emacs -f message-mailto %u
-# # If you prefer to use emacsclient, use this instead:
-# Exec=sh -c 'emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"%u\")"'
-# 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
diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop
new file mode 100644
index 0000000000..200389c4b5
--- /dev/null
+++ b/etc/emacsclient-mail.desktop
@@ -0,0 +1,19 @@
+[Desktop Entry]
+Categories=Network;Email;
+Comment=GNU Emacs is an extensible, customizable text editor - and more
+Exec=sh -c 'emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"%u\")"'
+Icon=emacs
+Name=Emacs (Mail, Client)
+MimeType=x-scheme-handler/mailto;
+NoDisplay=false
+Terminal=false
+Type=Application
+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
-- 
2.31.1


[-- Attachment #3: Type: text/plain, Size: 1567 bytes --]

From ae9e2fd889e7fb8a4348ace9304a9052a3cbc4e2 Mon Sep 17 00:00:00 2001
From: Peter Oliver <git@mavit.org.uk>
Date: Wed, 9 Jun 2021 12:51:15 +0100
Subject: [PATCH 2/3] Install emacs-mail.desktop and emacsclient-mail.desktop

* Makefile.in (install-etc): Install emacs-mail.desktop and
emacsclient-mail.desktop
---
 Makefile.in | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index 8fccdf7580..07081ec48e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -742,6 +742,19 @@ install-etc:
 	  ${srcdir}/etc/emacsclient.desktop > $${tmp}; \
 	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}.desktop"; \
 	rm -f $${tmp}
+	tmp=etc/emacs-mail.tmpdesktop; rm -f $${tmp}; \
+	sed -e "/^Exec=emacs/ s/emacs/${EMACS_NAME}/" \
+	  -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
+	  ${srcdir}/etc/emacs-mail.desktop > $${tmp}; \
+	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/${EMACS_NAME}-mail.desktop"; \
+	rm -f $${tmp}
+	tmp=etc/emacsclient-mail.tmpdesktop; rm -f $${tmp}; \
+	client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
+	sed -e "/^Exec=emacsclient/ s|emacsclient|${bindir}/$${client_name}|" \
+	  -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
+	  ${srcdir}/etc/emacsclient-mail.desktop > $${tmp}; \
+	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}-mail.desktop"; \
+	rm -f $${tmp}
 	umask 022; ${MKDIR_P} "$(DESTDIR)${metainfodir}"
 	tmp=etc/emacs.tmpmetainfo; rm -f $${tmp}; \
 	sed -e "s/emacs\.desktop/${EMACS_NAME}.desktop/" \
-- 
2.31.1


[-- Attachment #4: Type: text/plain, Size: 1525 bytes --]

From 79a34c97b9a344d14e5b7183eff49eac82a16b15 Mon Sep 17 00:00:00 2001
From: Peter Oliver <git@mavit.org.uk>
Date: Wed, 9 Jun 2021 12:58:39 +0100
Subject: [PATCH 3/3] Hide emacs-mail.desktop, emacsclient-mail.desktop from
 menus
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These are intended for use as mailto: URL handlers, not for launching
directly, so we can reduce clutter by hiding them from a desktop
environment’s menus.

* etc/emacs-mail.desktop, etc/emacsclient-mail.desktop: NoDisplay=true
---
 etc/emacs-mail.desktop       | 2 +-
 etc/emacsclient-mail.desktop | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/etc/emacs-mail.desktop b/etc/emacs-mail.desktop
index 3a96b9ec8c..3468033584 100644
--- a/etc/emacs-mail.desktop
+++ b/etc/emacs-mail.desktop
@@ -5,6 +5,6 @@ Exec=emacs -f message-mailto %u
 Icon=emacs
 Name=Emacs (Mail)
 MimeType=x-scheme-handler/mailto;
-NoDisplay=false
+NoDisplay=true
 Terminal=false
 Type=Application
diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop
index 200389c4b5..95f1f8008c 100644
--- a/etc/emacsclient-mail.desktop
+++ b/etc/emacsclient-mail.desktop
@@ -5,7 +5,7 @@ Exec=sh -c 'emacsclient --alternate-editor= --display="$DISPLAY" --eval "(messag
 Icon=emacs
 Name=Emacs (Mail, Client)
 MimeType=x-scheme-handler/mailto;
-NoDisplay=false
+NoDisplay=true
 Terminal=false
 Type=Application
 Actions=new-window;new-instance;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#49292: Acknowledgement (Improvements to emacs-mail.desktop)
       [not found] ` <handler.49292.B.162506205713309.ack@debbugs.gnu.org>
@ 2021-06-30 14:43   ` Peter Oliver
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Oliver @ 2021-06-30 14:43 UTC (permalink / raw)
  To: 49292

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

And here’s a slightly improved version of the first patch, which uses exec to prevent the sh process from potentially sticking around.

-- 
Peter Oliver

[-- Attachment #2: Type: text/plain, Size: 3131 bytes --]

From 4f5e9f789bc7919aa87327940b54bfde7ee979c2 Mon Sep 17 00:00:00 2001
From: Peter Oliver <git@mavit.org.uk>
Date: Wed, 9 Jun 2021 12:44:32 +0100
Subject: [PATCH] Provide an emacsclient-mail.desktop
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We provide both an emacs.desktop and an emacsclient.desktop, so for
consistency let’s do the same with mail.

* etc/emacs-mail.desktop: Extract suggestions for using emacsclient
from comments to create emacsclient-mail.desktop.
* etc/emacsclient-mail.desktop: Send mail using an existing Emacs
rather than starting a new one.
---
 etc/NEWS                     |  1 +
 etc/emacs-mail.desktop       | 14 +-------------
 etc/emacsclient-mail.desktop | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+), 13 deletions(-)
 create mode 100644 etc/emacsclient-mail.desktop

diff --git a/etc/NEWS b/etc/NEWS
index 701b9a73a8..3106bb1bed 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1073,6 +1073,7 @@ Clicking on a 'mailto:' link in other applications will then open
 Emacs with headers filled out according to the link, e.g.
 "mailto:larsi@gnus.org?subject=This+is+a+test".  If you prefer
 emacsclient, use "emacsclient -e '(message-mailto "%u")'"
+or "emacsclient-mail.desktop".
 
 ---
 *** Change to default value of 'message-draft-headers' user option.
diff --git a/etc/emacs-mail.desktop b/etc/emacs-mail.desktop
index 251afa100c..3a96b9ec8c 100644
--- a/etc/emacs-mail.desktop
+++ b/etc/emacs-mail.desktop
@@ -1,22 +1,10 @@
 [Desktop Entry]
 Categories=Network;Email;
 Comment=GNU Emacs is an extensible, customizable text editor - and more
+Exec=emacs -f message-mailto %u
 Icon=emacs
 Name=Emacs (Mail)
 MimeType=x-scheme-handler/mailto;
 NoDisplay=false
 Terminal=false
 Type=Application
-
-Exec=emacs -f message-mailto %u
-# # If you prefer to use emacsclient, use this instead:
-# Exec=sh -c 'emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"%u\")"'
-# 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
diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop
new file mode 100644
index 0000000000..4df79ed300
--- /dev/null
+++ b/etc/emacsclient-mail.desktop
@@ -0,0 +1,19 @@
+[Desktop Entry]
+Categories=Network;Email;
+Comment=GNU Emacs is an extensible, customizable text editor - and more
+Exec=sh -c 'exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"%u\")"'
+Icon=emacs
+Name=Emacs (Mail, Client)
+MimeType=x-scheme-handler/mailto;
+NoDisplay=false
+Terminal=false
+Type=Application
+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
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#49292: Improvements to emacs-mail.desktop
  2021-06-30 14:07 bug#49292: Improvements to emacs-mail.desktop Peter Oliver
       [not found] ` <handler.49292.B.162506205713309.ack@debbugs.gnu.org>
@ 2021-07-02 11:09 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-02 11:09 UTC (permalink / raw)
  To: Peter Oliver; +Cc: 49292

Peter Oliver <p.d.oliver@mavit.org.uk> writes:

> Attached are three patches to improve emacs-mail.desktop, which is new
> in Emacs 28:
>
> - Provide an emacsclient-mail.desktop, for consistency with emacsclient.desktop.
> - Install emacs-mail.desktop and emacsclient-mail.desktop.
> - Hide emacs-mail.desktop, emacsclient-mail.desktop from menus.

Peter Oliver <p.d.oliver@mavit.org.uk> writes:

> And here’s a slightly improved version of the first patch, which uses
> exec to prevent the sh process from potentially sticking around.

Thanks; pushed to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-02 11:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 14:07 bug#49292: Improvements to emacs-mail.desktop Peter Oliver
     [not found] ` <handler.49292.B.162506205713309.ack@debbugs.gnu.org>
2021-06-30 14:43   ` bug#49292: Acknowledgement (Improvements to emacs-mail.desktop) Peter Oliver
2021-07-02 11:09 ` bug#49292: Improvements to emacs-mail.desktop Lars Ingebrigtsen

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).