[Top][All Lists]

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

Re: xdg-email vs browse-url-mail

From: Dmitry Alexandrov
Subject: Re: xdg-email vs browse-url-mail
Date: Fri, 15 Jul 2016 21:29:29 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Kevin Brubeck Unhammer <> writes:

> Dmitry Alexandrov <> čálii:
>> Kevin Brubeck Unhammer <> writes:
>>> I just tried using browse-url-mail as a mailto-handler with the below
>>> script as my mail handler (set in XFCE settings):
>>> #!/bin/bash
>>> mailto="${*//\"/}"
>> ...
>>> if [[ ! ${mailto} =~ ^mailto: ]]; then
>>>     mailto="mailto:${mailto}";
>>> fi
>> Does not xdg-email(1) already do that?
> No. Try 'echo "$@">/tmp/log' at the top of your mail script.

I tried:

--8<---------------cut here---------------start------------->8---
$ xdg-email --version
xdg-email 1.1.0 rc1

$ cat /tmp/xdg-test

echo "$@" > /tmp/xdg-test.log

$ xdg-email

$ cat /tmp/xdg-test.log
--8<---------------cut here---------------end--------------->8---

>>> It seems to work with xdg-email, but when I use --attach to attach a
>>> file, it just appears as an "Attach: /path/to/file" header instead of
>>> the usual &lt;#part thing. After sending, nothing is attached to the
>>> received message that I can tell. Is there a way to make browse-url-mail
>>> do the right thing, or to make message-mode treat that "Attach:" line
>>> correctly?
>> Try this:
> [...]
>> (Note, that I have virtually no experience with elisp, so use at your
>> own risk. :-)
> That worked! And even handles multiple attachments correctly, even
> though xdg-email uses multiple "attach" headers (which
> warns against). Maybe open a
> bug report on this? It looks like an improvement to me.

Hmm...  Do you mean that I have to open a bug report?  I am not familiar
with GNU Emacs’ development customs, but a common sense suggests me that
a feature request had better be filed by one who could ground its
usefulness, while I hardy could.

Anyway, I think it worth to change it a bit more in order to make it try
to guess mime-type:

diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index a4d47f6..dca81fe 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -1597,7 +1597,8 @@ used instead of `browse-url-new-window-flag'."
           (if (not mml-mode)
               (error "Enable MML mode if you want to attach files")
             (dolist (attach attaches)
-              (mml-attach-file attach nil nil "attachment"))))))))
+              (mml-attach-file attach (mm-default-file-encoding attach)
+                               nil "attachment"))))))))
 ;; --- Random browser ---
> I don't know how attachments are handled by other mailto-users though –

For instance, Icedove (Thunderbird) does not support attaches in
‘mailto:’ at all and this is considered a feature [0].


> multiple identical hfname's or some separator in the hfvalue like with
> the "to" header?

The former seems to be the only way if we want to use xdg-email(1),
since it requires that argument of ‘--attach’ should be existing file,
not an arbitrary string and in particular not a comma separated list of

--8<---------------cut here---------------start------------->8---
$ xdg-email --attach hfsdg
xdg-email: file 'hfsdg' does not exist
--8<---------------cut here---------------end--------------->8---

reply via email to

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