emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0263216 3/3: Don't bind image commands on eww non-i


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 0263216 3/3: Don't bind image commands on eww non-image links
Date: Fri, 13 Apr 2018 18:18:36 -0400 (EDT)

branch: master
commit 0263216ec39d0914f17b662a3e45b4163ab6cc78
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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).
---
 lisp/net/eww.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index cb7390f..49bf10d 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]