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

w3m-view-header `=' on a linked image



With the current cvs looking at the foo.html below, if point is on the
"gpl" image then pressing `=' w3m-view-header doesn't show the href link
target.  I hoped that it would, the same as it does on linked text.

I struck this when experimenting with `=' to show an image location url,
per the diff below (not properly tested yet :-).  Then I noticed not
only it doesn't work but neither does the existing code that shows just
an anchor target.

A bit of tracing suggests point might be moved when the code goes to
look for the properties.  I wondered if it was due to
w3m-history-restore-position doing something different on a position
with an image, but I can't tell.  Would that about:/header thing extract
its information before any save/restore anyway?
Title: A Page

This is a linked image: GPLv3

--- w3m.el.~1.1552.~	2012-02-10 10:30:29.000000000 +1100
+++ w3m.el	2012-02-10 10:42:04.000000000 +1100
@@ -9950,15 +9950,26 @@
 	    (let ((time (w3m-last-modified url)))
 	      (if time (current-time-string time) "")))
 
-    (let (anchor anchor-title)
+    (let (anchor anchor-title
+          image-url image-alt image-size)
       (with-current-buffer w3m-current-buffer
 	(when (equal url w3m-current-url)
-	  (setq anchor (w3m-anchor))
-	  (setq anchor-title (w3m-anchor-title))))
+          (setq anchor (w3m-anchor)
+                anchor-title (w3m-anchor-title)
+                image-url (w3m-image)
+                image-alt (w3m-image-alt)
+                image-size (w3m-get-text-property-around 'w3m-image-size))))
       (if anchor
 	  (insert "\nCurrent Anchor: " anchor))
       (if anchor-title
-	  (insert "\nAnchor Title:   " anchor-title)))
+	  (insert "\nAnchor Title:   " anchor-title))
+      (if image-url
+          (insert "\nImage:      " image-url))
+      (if image-alt
+          (insert "\nImage Alt:  " image-alt))
+      (if image-size
+          (insert (format "\nImage Size: %sx%s"
+                          (car image-size) (cdr image-size)))))
 
     (let ((ct (w3m-arrived-content-type url))
 	  (charset (w3m-arrived-content-charset url))