-(defun elpher-url-to-url-string (url)
- "Get string representation of URL."
- (url-encode-url (url-recreate url)))
-
-(defun elpher-url-gopher-p (url)
- "Return non-nil if URL object specifies a gopher address."
- (let ((protocol (url-type url)))
- (if (or (string-equal protocol "gopher")
- (string-equal protocol "gophers")))))
-
-(defun elpher-gopher-url-selector-type (url)
- "Retrieve selector type from URL object."
- (let ((filename (url-filename url)))
- (if (> (length filename) 0)
- (string-to-char filename)
- ?1)))
-
-(defun elpher-gopher-url-selector (url)
- "Retrieve selector from URL object."
- (let ((filename (url-filename url)))
+(defun elpher-make-gopher-address (type selector host port)
+ "Create an ADDRESS object corresponding to the given gopher directory record
+attributes: TYPE, SELECTOR, HOST and PORT."
+ (elpher-address-from-url
+ (concat "gopher://" host ":" port "/" type selector)))
+
+(defun elpher-make-special-address (type)
+ "Create an ADDRESS object corresponding to the given special page symbol TYPE."
+ type)
+
+
+(defun elpher-address-to-url-string (address)
+ "Get string representation of ADDRESS, or nil if ADDRESS is special."
+ (if (not (elpher-address-special-p address))
+ (url-encode-url (url-recreate address))
+ nil))
+
+(defun elpher-address-type (address)
+ "Retrieve selector type from ADDRESS object."
+ (if (symbolp address)
+ (list 'special address)
+ (let ((protocol (url-type address)))
+ (cond ((or (string-equal protocol "gopher")
+ (string-equal protocol "gophers"))
+ (list 'gopher
+ ((let ((filename (url-filename address)))
+ (if (> (length filename) 0)
+ (string-to-char filename)
+ ?1)))))
+ ((string-equal protocol "gemini")
+ 'gemini)))))
+
+(defun elpher-address-protocol (address)
+ (if (symbolp address)
+ nil
+ (url-type address)))
+
+(defun elpher-gopher-address-selector (address)
+ "Retrieve selector from ADDRESS object."
+ (let ((filename (url-filename address)))