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)
This commit is contained in:
djcb
2017-04-08 15:21:06 +03:00
parent 895a78ba7b
commit 98b998b86d
3 changed files with 17 additions and 24 deletions

View File

@ -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 ()

View File

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

View File

@ -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")