]> git.eshelyaron.com Git - emacs.git/commitdiff
Make message-mailto work for emacsclient
authorRobert Pluim <rpluim@gmail.com>
Tue, 23 Feb 2021 12:47:49 +0000 (13:47 +0100)
committerRobert Pluim <rpluim@gmail.com>
Tue, 23 Feb 2021 12:50:37 +0000 (13:50 +0100)
* doc/misc/message.texi (System Mailer Setup): Add index entry.
Mention option to use emacsclient.

* etc/NEWS: Mention emacsclient option for 'mailto:' handling.

* etc/emacs-mail.desktop: Add example using emacsclient.

* lisp/gnus/message.el (message-mailto): Add optional url argument
so we can call it from emacsclient.

doc/misc/message.texi
etc/NEWS
etc/emacs-mail.desktop
lisp/gnus/message.el

index be6c9a419b2f72c075095e8153594641cf090a73..1497c710e4e652bca29b1c40e7077e4fee3af4bc 100644 (file)
@@ -540,6 +540,7 @@ better than you do.
 @node System Mailer Setup
 @section System Mailer Setup
 @cindex mailto:
+@cindex System Mailer
 
 Emacs can be set up as the system mailer, so that Emacs is opened when
 you click on @samp{mailto:} links in other programs.
@@ -548,10 +549,11 @@ How this is done varies from system to system, but commonly there's a
 way to set the default application for a @acronym{MIME} type, and the
 relevant type here is @samp{x-scheme-handler/mailto;}.
 
-The application to start should be @samp{"emacs -f message-mailto %u"}.
+The application to start should be @w{@samp{emacs -f message-mailto %u}}.
 This will start Emacs, and then run the @code{message-mailto}
 command.  It will parse the given @acronym{URL}, and set up a Message
-buffer with the given parameters.
+buffer with the given parameters.  If you prefer to use emacsclient,
+use @w{@samp{emacsclient -e '(message-mailto "%u")'}} as the application.
 
 For instance, @samp{mailto:larsi@@gnus.org?subject=This+is+a+test}
 will open a Message buffer with the @samp{To:} header filled in with
index 2411ddb830ebcad0c3f2a02204045e86f9543a67..236c8a9730a3ba4593358c31818403a17f91d032 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -830,10 +830,12 @@ instances.
 Emacs can be defined as a handler for the "x-scheme-handler/mailto"
 MIME type with the following command: "emacs -f message-mailto %u".
 An "emacs-mail.desktop" file has been included, suitable for
-installing in desktop directories like "/usr/share/applications".
+installing in desktop directories like "/usr/share/applications" or
+"~/.local/share/applications".
 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".
+"mailto:larsi@gnus.org?subject=This+is+a+test".  If you prefer
+emacsclient, use "emacsclient -e '(message-mailto "%u")'"
 
 ---
 *** Change to default value of 'message-draft-headers' user option.
index 3a96b9ec8c72fa0252ca4bf8ded69eef0864aea0..0c5fab1dd12ccc8b9623dedcd3a59783fab87d26 100644 (file)
@@ -2,6 +2,8 @@
 Categories=Network;Email;
 Comment=GNU Emacs is an extensible, customizable text editor - and more
 Exec=emacs -f message-mailto %u
+# If you prefer to use emacsclient, use this instead
+#Exec=emacsclient -e '(message-mailto "%u")'
 Icon=emacs
 Name=Emacs (Mail)
 MimeType=x-scheme-handler/mailto;
index ee98099e08bd5659797d629efaab09c436ef2781..1e0362a3bfa3e55b72520442ce8f646cd32cab3b 100644 (file)
@@ -8891,15 +8891,16 @@ used to take the screenshot."
     retval))
 
 ;;;###autoload
-(defun message-mailto ()
+(defun message-mailto (&optional url)
   "Command to parse command line mailto: links.
 This is meant to be used for MIME handlers: Setting the handler
 for \"x-scheme-handler/mailto;\" to \"emacs -f message-mailto %u\"
-will then start up Emacs ready to compose mail."
+will then start up Emacs ready to compose mail.  For emacsclient use
+  emacsclient -e '(message-mailto \"%u\")'"
   (interactive)
   ;; <a href="mailto:someone@example.com?subject=This%20is%20the%20subject&cc=someone_else@example.com&body=This%20is%20the%20body">Send email</a>
   (message-mail)
-  (message-mailto-1 (pop command-line-args-left)))
+  (message-mailto-1 (or url (pop command-line-args-left))))
 
 (defun message-mailto-1 (url)
   (let ((args (message-parse-mailto-url url)))