From: Lars Ingebrigtsen Date: Fri, 13 Apr 2018 22:17:36 +0000 (+0200) Subject: Don't bind image commands on eww non-image links X-Git-Tag: emacs-27.0.90~5231 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0263216ec39d0914f17b662a3e45b4163ab6cc78;p=emacs.git Don't bind image commands on eww non-image links * lisp/net/eww.el (eww-link-keymap): Only inherit the normal shr keymap. (eww-image-link-keymap): New keymap with the image bindings. (eww-tag-a): Use the appropriate one on links (bug#30148). --- diff --git a/lisp/net/eww.el b/lisp/net/eww.el index cb7390f4724..49bf10d4ebe 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -224,6 +224,11 @@ See also `eww-form-checkbox-selected-symbol'." "When this regex is found in the URL, it's not a keyword but an address.") (defvar eww-link-keymap + (let ((map (copy-keymap shr-map))) + (define-key map "\r" 'eww-follow-link) + map)) + +(defvar eww-image-link-keymap (let ((map (copy-keymap shr-image-map))) (define-key map "\r" 'eww-follow-link) map)) @@ -551,7 +556,11 @@ Currently this means either text/html or application/xhtml+xml." (eww-handle-link dom) (let ((start (point))) (shr-tag-a dom) - (put-text-property start (point) 'keymap eww-link-keymap))) + (put-text-property start (point) + 'keymap + (if (mm-images-in-region-p start (point)) + eww-image-link-keymap + eww-link-keymap)))) (defun eww-update-header-line-format () (setq header-line-format