* mu4e-view: fix visiting mailto: links (emacs23)

This commit is contained in:
djcb
2012-06-23 19:38:06 +03:00
parent 5fba6583ef
commit 325dfdc483

View File

@ -99,11 +99,6 @@ buffer."
if you're using an emacs with Imagemagick support." if you're using an emacs with Imagemagick support."
:group 'mu4e-view) :group 'mu4e-view)
(defvar mu4e-view-browse-url-mailto-function
'mu4e~compose-browse-url-mail
"Function to use for mailto: links.")
(defvar mu4e-view-actions (defvar mu4e-view-actions
'( ("capture message" . mu4e-action-capture-message) '( ("capture message" . mu4e-action-capture-message)
("view as pdf" . mu4e-action-view-as-pdf)) ("view as pdf" . mu4e-action-view-as-pdf))
@ -145,12 +140,6 @@ where:
"Regexp that matches http:/https:/mailto: URLs; match-string 1 "Regexp that matches http:/https:/mailto: URLs; match-string 1
will contain the matched URL, if any.") will contain the matched URL, if any.")
(defconst mu4e~view-mailto-regexp
"\\("
"Regexp that matches mailto: URLs; match-string 1 will contain
the matched URL, if any.")
(defvar mu4e~view-attach-map nil (defvar mu4e~view-attach-map nil
"A mapping of user-visible attachment number to the actual part index.") "A mapping of user-visible attachment number to the actual part index.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -534,9 +523,6 @@ is nil, and otherwise open it."
(make-local-variable 'mu4e~view-lines-wrapped) (make-local-variable 'mu4e~view-lines-wrapped)
(make-local-variable 'mu4e~view-cited-hidden) (make-local-variable 'mu4e~view-cited-hidden)
(make-local-variable 'browse-url-mailto-function)
(setq browse-url-mailto-function mu4e-view-browse-url-mailto-function)
(setq buffer-undo-list t) ;; don't record undo info (setq buffer-undo-list t) ;; don't record undo info
;; autopair mode gives error when pressing RET ;; autopair mode gives error when pressing RET
@ -603,11 +589,16 @@ Seen; if the message is not New/Unread, do nothing."
"Return a function that executes `browse-url' with URL. What "Return a function that executes `browse-url' with URL. What
browser is called is depending on `browse-url-browser-function' and browser is called is depending on `browse-url-browser-function' and
`browse-url-mailto-function'." `browse-url-mailto-function'."
(lexical-let ((url url)) (save-match-data
(lambda () (if (string-match "^mailto:" url)
(interactive) (lexical-let ((url url))
(browse-url url)))) (lambda ()
(interactive)
(mu4e~compose-browse-url-mail url)))
(lexical-let ((url url))
(lambda ()
(interactive)
(browse-url url))))))
(defun mu4e~view-show-images-maybe (msg) (defun mu4e~view-show-images-maybe (msg)
"Show attached images, if `mu4e-view-show-images' is non-nil." "Show attached images, if `mu4e-view-show-images' is non-nil."
@ -640,9 +631,9 @@ number them so they can be opened using `mu4e-view-go-to-url'."
`(face mu4e-view-link-face `(face mu4e-view-link-face
mouse-face highlight mouse-face highlight
keymap ,map) url) keymap ,map) url)
(replace-match (concat url (replace-match
(propertize (format "[%d]" num) (concat url
'face 'mu4e-view-url-number-face)))))))) (propertize (format "[%d]" num) 'face 'mu4e-view-url-number-face))))))))
(defun mu4e~view-wrap-lines () (defun mu4e~view-wrap-lines ()
@ -1016,7 +1007,7 @@ user that unmarking only works in the header list."
(interactive "n[mu4e] Visit url with number: ") (interactive "n[mu4e] Visit url with number: ")
(let ((url (gethash num mu4e~view-link-map))) (let ((url (gethash num mu4e~view-link-map)))
(unless url (error "Invalid number for URL")) (unless url (error "Invalid number for URL"))
(browse-url url))) (funcall (mu4e~view-browse-url-func url))))
(defconst mu4e~view-raw-buffer-name "*mu4e-raw-view*" (defconst mu4e~view-raw-buffer-name "*mu4e-raw-view*"
"*internal* Name for the raw message view buffer") "*internal* Name for the raw message view buffer")