From: Tim Vaughan Date: Wed, 3 Jun 2020 08:36:30 +0000 (+0200) Subject: Tiny refactor. X-Git-Tag: v2.7.10~3 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=e643d174d3244b97b14755f8a4ab48a5dfeaf693;p=elpher.git Tiny refactor. --- diff --git a/elpher.el b/elpher.el index be60abf..7605bdf 100644 --- a/elpher.el +++ b/elpher.el @@ -1116,18 +1116,18 @@ For instance, the filename /a/b/../c/./d will reduce to /a/c/d" (defun elpher-address-from-gemini-url (url) "Extract address from URL with defaults as per gemini map files." - (let ((address (url-generic-parse-url url))) + (let ((address (url-generic-parse-url url)) + (current-address (elpher-page-address elpher-current-page))) (unless (and (url-type address) (not (url-fullness address))) ;avoid mangling mailto: urls (setf (url-fullness address) t) (if (url-host address) ;if there is an explicit host, filenames are absolute (if (string-empty-p (url-filename address)) (setf (url-filename address) "/")) ;ensure empty filename is marked as absolute - (setf (url-host address) (url-host (elpher-page-address elpher-current-page))) - (setf (url-port address) (url-port (elpher-page-address elpher-current-page))) + (setf (url-host address) (url-host current-address)) + (setf (url-port address) (url-port current-address)) (unless (string-prefix-p "/" (url-filename address)) ;deal with relative links (setf (url-filename address) - (concat (file-name-directory - (url-filename (elpher-page-address elpher-current-page))) + (concat (file-name-directory (url-filename current-address)) (url-filename address))))) (unless (url-type address) (setf (url-type address) "gemini"))