diff --git a/doc/misc/message.texi b/doc/misc/message.texi index be6c9a419b2..1497c710e4e 100644 --- a/doc/misc/message.texi +++ b/doc/misc/message.texi @@ -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 diff --git a/etc/NEWS b/etc/NEWS index 2411ddb830e..236c8a9730a 100644 --- 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. diff --git a/etc/emacs-mail.desktop b/etc/emacs-mail.desktop index 3a96b9ec8c7..0c5fab1dd12 100644 --- a/etc/emacs-mail.desktop +++ b/etc/emacs-mail.desktop @@ -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; diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index ee98099e08b..1e0362a3bfa 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -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) ;; Send email (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)))