From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/18286 Path: news.gmane.org!not-for-mail From: Dmitry Alexandrov <321942@gmail.com> Newsgroups: gmane.emacs.gnus.user Subject: Re: xdg-email vs browse-url-mail Date: Fri, 15 Jul 2016 00:09:31 +0300 Message-ID: <87r3awc4fo.fsf@gmail.com> References: <874m7sfkne.fsf@fsfe.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1468530585 21378 80.91.229.3 (14 Jul 2016 21:09:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Jul 2016 21:09:45 +0000 (UTC) Cc: info-gnus-english@gnu.org To: Kevin Brubeck Unhammer Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Thu Jul 14 23:09:35 2016 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bNnsy-0002z5-No for gegu-info-gnus-english@m.gmane.org; Thu, 14 Jul 2016 23:09:32 +0200 Original-Received: from localhost ([::1]:57036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNnsx-0004jk-Vs for gegu-info-gnus-english@m.gmane.org; Thu, 14 Jul 2016 17:09:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <321942@gmail.com>) id 1bNnsu-0004iC-8q for info-gnus-english@gnu.org; Thu, 14 Jul 2016 17:09:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <321942@gmail.com>) id 1bNnsq-0002bN-7D for info-gnus-english@gnu.org; Thu, 14 Jul 2016 17:09:28 -0400 Original-Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]:35712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <321942@gmail.com>) id 1bNnsp-0002bC-Qf for info-gnus-english@gnu.org; Thu, 14 Jul 2016 17:09:24 -0400 Original-Received: by mail-lf0-x236.google.com with SMTP id f93so73600991lfi.2 for ; Thu, 14 Jul 2016 14:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:mail-copies-to :date:message-id:mime-version; bh=AQNQWLLBLon75/qMecCc9hpfujNVc6I8zlcaXllEUTw=; b=rsxdBWxCkR1uwNNttirlkBg7JQWbPsvspOwS1O6DJGYpNolVWUMH28vVeWI5C6Tuzq O1hFinIutZoe6QDJAV7w3BYtwEedCKF8rKMP9NTkHEZt/+7VWTRcHCyom7uw8qOQgULj VprfcCX0HhGyQ0BAbaMqv4dBZbDcV6vnpSMTLG4EeFYUScdqMyPYGrSUIaLZtKwoani5 RxnVqunCRMWn7QAhWAVR4oONc1HpjxXjj/khvZC5Kk6zsC+PYBO0G81nPJJyZmtXv3zi lKcyuw95WbvgjssVlAyxgvJtMIHDhI3vbBqthPPPkQ5ACuyizUJlBwRSwzR9jCCF3/YJ 3Jyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:mail-copies-to:date:message-id:mime-version; bh=AQNQWLLBLon75/qMecCc9hpfujNVc6I8zlcaXllEUTw=; b=ZJOS1G3PE3f0R8TWXn0iJ6+fR5qOxZpA79uq4DD9iZmgH9M1+yVIFIWdZbl6QYiUYM 5eXlBUqZAjhvKNLuxE7WSfCMozReXsYgwl+XisUo59E1Vd0m6Cgk4mrLmioBrOylL6G0 nwSroNu1J9+PJyT5S1GJA5upRpMV/GEezUq3GS4Lc+UwjJPcXkqdJuuDgDiwM4YmVO+v OW01KJjt8gCpkiqG7lRaNatRD9FYfW+1jIe9v5v/igSAA6RhreYaJNkYNwjKCpxnQ69F xHFyS8aVj1lQSvPJQ87aEeMFOMFUQt7DcsWVyeAmK3hJpgCLRksv+B/fMXAOqVgEK+6Q l3kQ== X-Gm-Message-State: ALyK8tLbQtDqacSHDzRJmSJok9fR9YOD2+7JoRzMMLuRvhMkS18q7SPxHUHXnxmR6QYMLg== X-Received: by 10.46.71.149 with SMTP id u143mr4787739lja.18.1468530562796; Thu, 14 Jul 2016 14:09:22 -0700 (PDT) Original-Received: from asus.local ([178.218.27.218]) by smtp.gmail.com with ESMTPSA id l19sm1180990lfi.24.2016.07.14.14.09.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jul 2016 14:09:22 -0700 (PDT) In-Reply-To: <874m7sfkne.fsf@fsfe.org> (Kevin Brubeck Unhammer's message of "Thu, 14 Jul 2016 14:51:01 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Mail-Copies-To: always X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::236 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Original-Sender: "info-gnus-english" Xref: news.gmane.org gmane.emacs.gnus.user:18286 Archived-At: --=-=-= Content-Type: text/plain 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? > emacsclient -c --eval "(browse-url-mail \"${mailto}\")" > > 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 <#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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=browse-url-mail.patch diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index c0b3591..a4d47f6 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -1562,31 +1562,42 @@ When called non-interactively, optional second argument NEW-WINDOW is used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "Mailto URL: ")) (save-excursion - (let* ((alist (rfc2368-parse-mailto-url url)) - (to (assoc "To" alist)) - (subject (assoc "Subject" alist)) - (body (assoc "Body" alist)) - (rest (delq to (delq subject (delq body alist)))) - (to (cdr to)) - (subject (cdr subject)) - (body (cdr body)) - (mail-citation-hook (unless body mail-citation-hook))) - (if (browse-url-maybe-new-window new-window) - (compose-mail-other-window to subject rest nil - (list 'insert-buffer (current-buffer))) - (compose-mail to subject rest nil nil - (list 'insert-buffer (current-buffer)))) - (when body - (goto-char (point-min)) - (unless (or (search-forward (concat "\n" mail-header-separator "\n") - nil 'move) - (bolp)) - (insert "\n")) - (goto-char (prog1 - (point) - (insert (replace-regexp-in-string "\r\n" "\n" body)) - (unless (bolp) - (insert "\n")))))))) + (let ((headers (rfc2368-parse-mailto-url url)) + to subject body attaches rest) + (dolist (header headers) + (cond + ((equal (car header) "To") + (setq to (cdr header))) + ((equal (car header) "Subject") + (setq subject (cdr header))) + ((equal (car header) "Body") + (setq body (cdr header))) + ((equal (car header) "Attach") + (add-to-list 'attaches (cdr header))) + (t + (push header rest)))) + (let ((mail-citation-hook (unless body mail-citation-hook))) + (if (browse-url-maybe-new-window new-window) + (compose-mail-other-window to subject rest nil + (list 'insert-buffer (current-buffer))) + (compose-mail to subject rest nil nil + (list 'insert-buffer (current-buffer)))) + (when body + (goto-char (point-min)) + (unless (or (search-forward (concat "\n" mail-header-separator "\n") + nil 'move) + (bolp)) + (insert "\n")) + (goto-char (prog1 + (point) + (insert (replace-regexp-in-string "\r\n" "\n" body)) + (unless (bolp) + (insert "\n"))))) + (when attaches + (if (not mml-mode) + (error "Enable MML mode if you want to attach files") + (dolist (attach attaches) + (mml-attach-file attach nil nil "attachment")))))))) ;; --- Random browser --- --=-=-= Content-Type: text/plain (Note, that I have virtually no experience with elisp, so use at your own risk. :-) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline