X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=elpher.git;a=blobdiff_plain;f=elpher.el;h=d1d795c649e42237bb40ac26129a2b48cda4bcb5;hp=210824af7866f721377a60295b9eefdd366783d3;hb=4796bc48d4083ccab4be79075b15ea70acdc2fa0;hpb=ccb0eabe1241fd388cdf37d0d6c50193dad600fb 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'."