emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7788129: Make message-mailto work for emacsclient


From: Robert Pluim
Subject: master 7788129: Make message-mailto work for emacsclient
Date: Tue, 23 Feb 2021 07:52:14 -0500 (EST)

branch: master
commit 7788129c3adb328ce838282ebc303368e2392d5d
Author: Robert Pluim <rpluim@gmail.com>
Commit: Robert Pluim <rpluim@gmail.com>

    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.
---
 doc/misc/message.texi  | 6 ++++--
 etc/NEWS               | 6 ++++--
 etc/emacs-mail.desktop | 2 ++
 lisp/gnus/message.el   | 7 ++++---
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/doc/misc/message.texi b/doc/misc/message.texi
index be6c9a4..1497c71 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 2411ddb..236c8a9 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 3a96b9e..0c5fab1 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 ee98099..1e0362a 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)
   ;; <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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]