;; Author: Tim Vaughan <tgvaughan@gmail.com>
;; 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"))
;;; Global constants
;;
-(defconst elpher-version "1.2.3"
+(defconst elpher-version "1.2.4"
"Current version of elpher.")
(defconst elpher-margin-width 6
(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'."