X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=elpher.git;a=blobdiff_plain;f=elpher.el;h=c6627dfaedc519d153693cc9e8db9b26e87dff41;hp=9bdc49efdcea2599bf18e0de97d87213f428696f;hb=2ebb812f7d0df8f0e338355f1722a6bb0950befa;hpb=58e018e92e7c6667c9c163f13a1592248d654b53 diff --git a/elpher.el b/elpher.el index 9bdc49e..c6627df 100644 --- a/elpher.el +++ b/elpher.el @@ -511,14 +511,17 @@ readability." "Return an IRI for URL. Decode percent-escapes and handle punycode in the domain name. Drop the password, if any." - (let* ((address (elpher-address-from-url (elpher-decode (url-unhex-string url)))) - (host (url-host address)) - (pass (url-password address))) - (when host - (setf (url-host address) (puny-decode-domain host))) - (when pass ; RFC 3986 says we should not render - (setf (url-password address) nil)) ; the password as clear text - (url-recreate-url address))) + (let ((data (match-data))) ; Prevent parsing clobbering match data + (unwind-protect + (let* ((address (elpher-address-from-url (elpher-decode (url-unhex-string url)))) + (host (url-host address)) + (pass (url-password address))) + (when host + (setf (url-host address) (puny-decode-domain host))) + (when pass ; RFC 3986 says we should not render + (setf (url-password address) nil)) ; the password as clear text + (url-recreate-url address)) + (set-match-data data)))) (defvar elpher-current-page nil "The current page for this Elpher buffer.") @@ -1684,6 +1687,8 @@ Assumes UTF-8 encoding for all text files." (elpher-render-text (decode-coding-string body 'utf-8))) ((or "jpg" "jpeg" "gif" "png" "bmp" "tif" "tiff") (elpher-render-image body)) + ((or "gopher" "gophermap") + (elpher-render-index (elpher-decode body))) (_ (elpher-render-download body)))) (elpher-restore-pos))))