summaryrefslogtreecommitdiff
path: root/lisp/gnus/mm-decode.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2013-06-17 09:19:50 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2013-06-17 09:19:50 +0000
commit7304e4dd67bb88abadf198f47e75cea971aaa5cc (patch)
tree183bd9a84da52497ce1a012ab3ee0b6bdf3ccfb2 /lisp/gnus/mm-decode.el
parentd363bffbedce7027288fbe7f05040e4ff71ff4bc (diff)
downloademacs-7304e4dd67bb88abadf198f47e75cea971aaa5cc.tar.gz
emacs-7304e4dd67bb88abadf198f47e75cea971aaa5cc.tar.bz2
emacs-7304e4dd67bb88abadf198f47e75cea971aaa5cc.zip
Convert shr.el from using overlays into using text properties
* eww.el (eww-mode-map): Use `shr-next-link' (etc) instead of the widget commands, since we're no longer using widgets for links. * mm-decode.el (mm-convert-shr-links): New function to convert new-style shr URL links into widgets. (mm-shr): Use it. * shr.el (shr-next-link): New command. (shr-previous-link): New command. (shr-urlify): Don't use `widget-convert', because that's slow. (shr-put-color-1): Use `add-face-text-property' instead of overlays, because collecting the overlays and reapplying them when generating tables is slow. (shr-insert-table): Ditto.
Diffstat (limited to 'lisp/gnus/mm-decode.el')
-rw-r--r--lisp/gnus/mm-decode.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index b025f7cc601..948b2a2fd1c 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1809,6 +1809,7 @@ If RECURSIVE, search recursively."
(libxml-parse-html-region (point-min) (point-max))))
(unless (bobp)
(insert "\n"))
+ (mm-convert-shr-links)
(mm-handle-set-undisplayer
handle
`(lambda ()
@@ -1816,6 +1817,20 @@ If RECURSIVE, search recursively."
(delete-region ,(point-min-marker)
,(point-max-marker))))))))
+(defun mm-convert-shr-links ()
+ (let ((start (point-min))
+ end)
+ (while (and start
+ (< start (point-max)))
+ (when (setq start (text-property-not-all start (point-max) 'shr-url nil))
+ (setq end (next-single-property-change start 'shr-url nil (point-max)))
+ (widget-convert-button
+ 'url-link start end
+ :help-echo (get-text-property start 'help-echo)
+ :keymap shr-map
+ (get-text-property start 'shr-url))
+ (setq start end)))))
+
(defun mm-handle-filename (handle)
"Return filename of HANDLE if any."
(or (mail-content-type-get (mm-handle-type handle)