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

Re: link anchor with % escape

In [emacs-w3m : No.12392]
	On Thu, 18 Dec 2014 17:56:09 +1100, Kevin Ryde wrote:
> In file foo.html browsed with recent cvs w3m and debian i386 emacs 24.4,
> pressing Ret on "link to section Foo" gives a message

>     No such anchor: Fo%6F

> where I hoped it might go to the Foo anchor, since %6F is "o".  Oldish
> iceape or recent iceweasel do that, but w3m and lynx don't.  Is a link
> allowed to have such escapes in the anchor part?

>     <a href="#Fo%6F">...

I don't know whether such a form is valid or not, but confirmed
at least Firefox supports it.  If it happens for only the name
portion of a url, we can make `w3m-search-name-anchor' search
for both "name" and (w3m-url-decode-string "name").  Could you
try this patch?
--- w3m.el~	2014-10-06 23:56:17.000000000 +0000
+++ w3m.el	2014-12-20 02:12:25.827361800 +0000
@@ -6763,8 +6763,9 @@
   (interactive "sName: ")
   (let ((pos (point-min))
 	(cur-pos (point))
-	found)
+	oname found)
     (catch 'found
+      (while (not found)
       (while (setq pos (next-single-property-change pos 'w3m-name-anchor))
 	(when (member name (get-text-property pos 'w3m-name-anchor))
 	  (goto-char pos)
@@ -6778,8 +6779,14 @@
 	  (when (eolp) (forward-line))
 	  (throw 'found (setq found t))))
-      (unless quiet
-	(message "No such anchor: %s" name)))
+      (if oname
+	  (progn
+	    (unless quiet
+	      (message "No such anchor: %s" oname))
+	    (throw 'found nil))
+	(setq pos (point-min)
+	      oname name
+	      name (w3m-url-decode-string name)))))
     (when (and found
 	       (not no-record)