]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/mm-decode.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / gnus / mm-decode.el
index f45337dc04222c60b0ae41766e252e773ace3c5c..c653d735543356a506cc2c4aa08dfce08f3328b5 100644 (file)
@@ -425,13 +425,15 @@ functions), `mm-file-name-delete-whitespace',
   :group 'mime-display)
 
 
-(defvar mm-path-name-rewrite-functions nil
-  "*List of functions for rewriting the full file names of MIME parts.
+(defcustom mm-path-name-rewrite-functions nil
+  "List of functions for rewriting the full file names of MIME parts.
 This is used when viewing parts externally, and is meant for
 transforming the absolute name so that non-compliant programs can find
 the file where it's saved.
 
-Each function takes a file name as input and returns a file name.")
+Each function takes a file name as input and returns a file name."
+  :type '(repeat function)
+  :group 'mime-display)
 
 (defvar mm-file-name-replace-whitespace nil
   "String used for replacing whitespace characters; default is `\"_\"'.")
@@ -1838,10 +1840,11 @@ If RECURSIVE, search recursively."
 (defvar shr-image-map)
 
 (autoload 'widget-convert-button "wid-edit")
+(defvar widget-keymap)
 
 (defun mm-convert-shr-links ()
   (let ((start (point-min))
-       end)
+       end keymap)
     (while (and start
                (< start (point-max)))
       (when (setq start (text-property-not-all start (point-max) 'shr-url nil))
@@ -1849,10 +1852,16 @@ If RECURSIVE, search recursively."
        (widget-convert-button
         'url-link start end
         :help-echo (get-text-property start 'help-echo)
-        ;;; FIXME Should only use the image map on images.
-        :keymap shr-image-map
+        :keymap (setq keymap (copy-keymap shr-map))
         (get-text-property start 'shr-url))
-       (put-text-property start end 'local-map nil)
+       ;; Remove keymap that `shr-urlify' adds.
+       (put-text-property start end 'keymap nil)
+       ;; Mask keys that launch `widget-button-click'.
+       ;; Those bindings are provided by `widget-keymap'
+       ;; that is a parent of `gnus-article-mode-map'.
+       (dolist (key (where-is-internal #'widget-button-click widget-keymap))
+         (unless (lookup-key keymap key)
+           (define-key keymap key #'ignore)))
        (dolist (overlay (overlays-at start))
          (overlay-put overlay 'face nil))
        (setq start end)))))