From: Tim Vaughan Date: Wed, 19 Jun 2019 20:16:19 +0000 (+0200) Subject: Fixed bug in non-gopher URL construction. X-Git-Tag: v1.2.4 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=4796bc48d4083ccab4be79075b15ea70acdc2fa0;p=elpher.git Fixed bug in non-gopher URL construction. --- diff --git a/elpher.el b/elpher.el index 210824a..d1d795c 100644 --- a/elpher.el +++ b/elpher.el @@ -4,7 +4,7 @@ ;; Author: Tim Vaughan ;; Created: 11 April 2019 -;; Version: 1.2.3 +;; Version: 1.2.4 ;; Keywords: comm gopher ;; Homepage: https://github.com/tgvaughan/elpher ;; Package-Requires: ((emacs "25")) @@ -57,7 +57,7 @@ ;;; Global constants ;; -(defconst elpher-version "1.2.3" +(defconst elpher-version "1.2.4" "Current version of elpher.") (defconst elpher-margin-width 6 @@ -1013,14 +1013,20 @@ host, selector and port." (defun elpher-get-address-url (address) "Get URL representation of ADDRESS." - (concat "gopher://" - (elpher-address-host address) - (let ((port (elpher-address-port address))) - (if (equal port 70) - "" - (format ":%d" port))) - "/" (string (elpher-address-type address)) - (elpher-address-selector address))) + (let ((type (elpher-address-type address)) + (selector (elpher-address-selector address)) + (host (elpher-address-host address)) + (port (elpher-address-port address))) + (if (and (equal type ?h) + (string-prefix-p "URL:" selector)) + (elt (split-string selector "URL:") 1) + (concat "gopher://" + host + (if (equal port 70) + "" + (format ":%d" port)) + "/" (string type) + selector)))) (defun elpher-copy-node-url (node) "Copy URL representation of address of NODE to `kill-ring'."