From 98b998b86d6b6cce5ecf0294b16e0c63e245e006 Mon Sep 17 00:00:00 2001 From: djcb Date: Sat, 8 Apr 2017 15:21:06 +0300 Subject: [PATCH] mu4e: remove mu4e~compose-browse-url-mail Instead, rely on the common browse-url-mail, which does the right thing after (setq mail-user-agent 'mu4e-user-agent) --- mu4e/mu4e-compose.el | 19 +------------------ mu4e/mu4e-view.el | 12 +++++++----- mu4e/mu4e.texi | 10 +++++++++- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 155fc121..c48efe3d 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -821,26 +821,9 @@ draft message." ;; returning the symbol is probably the correct thing to do, as other ;; such functions suggest. (defun mu4e-user-agent () + "Return the `mu4e-user-agent' symbol." 'mu4e-user-agent) -(defun mu4e~compose-browse-url-mail (url &optional ignored) - "Adapter for `browse-url-mailto-function." - (let* ((headers (rfc2368-parse-mailto-url url)) - (to (cdr (assoc "To" headers))) - (cc (assoc "Cc" headers)) - (subject (cdr (assoc "Subject" headers))) - (body (cdr (assoc "Body" headers)))) - (mu4e~compose-mail to subject (delq nil `(,cc))) - (if body - (progn - (message-goto-body) - (insert body) - (if (not to) - (message-goto-to) - (if (not subject) - (message-goto-subject) - (message-goto-body))))))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mu4e-compose-goto-top () diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 5532f53c..f69ac135 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -833,7 +833,8 @@ changes, it triggers a refresh." (let ((flags (mu4e-message-field msg :flags)) (msgid (mu4e-message-field msg :message-id)) (docid (mu4e-message-field msg :docid))) - ;; attached (embedded) messages don't have docids; leave them alone if it is a new message + ;; attached (embedded) messages don't have docids; leave them alone if it + ;; is a new message (when (and docid (or (member 'unread flags) (member 'new flags))) ;; mark /all/ messages with this message-id as read, so all copies of ;; this message will be marked as read. @@ -842,14 +843,14 @@ changes, it triggers a refresh." (defun mu4e~view-browse-url-func (url) "Return a function that executes `browse-url' with URL. -What browser is called is depending on +The browser that is called depends on `browse-url-browser-function' and `browse-url-mailto-function'." (save-match-data (if (string-match "^mailto:" url) (lexical-let ((url url)) (lambda () (interactive) - (mu4e~compose-browse-url-mail url))) + (browse-url-mail url))) (lexical-let ((url url)) (lambda () (interactive) @@ -863,7 +864,7 @@ If the url is mailto link, start writing an email to that address." (let* (( url (or url (mu4e~view-get-property-from-event 'mu4e-url)))) (when url (if (string-match-p "^mailto:" url) - (mu4e~compose-browse-url-mail url) + (browse-url-mail url) (browse-url url))))) (defun mu4e~view-show-images-maybe (msg) @@ -1453,7 +1454,8 @@ string." a single one, otherwise, offer to go to a range of urls." (interactive "P") (mu4e~view-handle-urls "URL to visit" - multi (lambda (url) (mu4e~view-browse-url-from-binding url)))) + multi + (lambda (url) (mu4e~view-browse-url-from-binding url)))) (defun mu4e-view-save-url (&optional multi) "Offer to save urls(s) to the kill-ring. If diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index dc072050..67e16bb0 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -3369,6 +3369,9 @@ see, most of it is commented-out. ;; make sure mu4e is in your load-path (require 'mu4e) +;; use mu4e for e-mail in emacs +(setq mail-user-agent 'mu4e-user-agent) + ;; Only needed if your maildir is _not_ ~/Maildir ;; Must be a real dir, not a symlink ;;(setq mu4e-maildir "/home/user/Maildir") @@ -3403,6 +3406,9 @@ customize. ;; example configuration for mu4e (require 'mu4e) +;; use mu4e for e-mail in emacs +(setq mail-user-agent 'mu4e-user-agent) + ;; path to our Maildir directory (setq mu4e-maildir "/home/user/Maildir") @@ -3423,7 +3429,6 @@ customize. ;; a list of user's e-mail addresses (setq mu4e-user-mail-address-list '("foo@@bar.example.com" "cuux@@example.com") - ;; the headers to show in the headers list -- a pair of a field ;; and its width, with `nil' meaning 'unlimited' ;; (better only use that for the last field. @@ -3571,6 +3576,9 @@ Next step: let's make a @t{mu4e} configuration for this: @lisp (require 'mu4e) +;; use mu4e for e-mail in emacs +(setq mail-user-agent 'mu4e-user-agent) + ;; default ;; (setq mu4e-maildir "~/Maildir")