1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-25 10:47:00 +00:00

Make message-mailto work for emacsclient

* 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.
This commit is contained in:
Robert Pluim 2021-02-23 13:47:49 +01:00
parent 7ebdecfcdf
commit 7788129c3a
4 changed files with 14 additions and 7 deletions

View 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

View File

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

View 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;

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