(require 'mail-parse)
(require 'mm-bodies)
+(require 'shr)
(eval-when-compile (require 'cl-lib))
(autoload 'gnus-map-function "gnus-util")
(let ((inhibit-read-only t))
(delete-region min max))))))))
-(defvar shr-image-map)
-
(autoload 'widget-convert-button "wid-edit")
(defvar widget-keymap)
(widget-convert-button
'url-link start end
:help-echo (get-text-property start 'help-echo)
- :keymap (setq keymap (copy-keymap shr-image-map))
+ :keymap (setq keymap (copy-keymap
+ (if (mm--images-in-region-p start end)
+ shr-image-map
+ shr-map)))
(get-text-property start 'shr-url))
;; Mask keys that launch `widget-button-click'.
;; Those bindings are provided by `widget-keymap'
(overlay-put overlay 'face nil))
(setq start end)))))
+(defun mm--images-in-region-p (start end)
+ (let ((found nil))
+ (save-excursion
+ (goto-char start)
+ (while (and (not found)
+ (< (point) end))
+ (let ((display (get-text-property (point) 'display)))
+ (when (and (consp display)
+ (eq (car display) 'image))
+ (setq found t)))
+ (forward-char 1)))
+ found))
+
(defun mm-handle-filename (handle)
"Return filename of HANDLE if any."
(or (mail-content-type-get (mm-handle-type handle)