X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=elpher.git;a=blobdiff_plain;f=elpher.el;h=25de855ecdf3261a66eed015b4f7e9eff671b1a6;hp=04f38a33c936bf320c3ba70068880b553470a248;hb=95604af39c717c89fa434b2d081ff9bf2bad992b;hpb=ab6a018cc080dfedca166a8c053538f3248f1eb6 diff --git a/elpher.el b/elpher.el index 04f38a3..25de855 100644 --- a/elpher.el +++ b/elpher.el @@ -4,7 +4,7 @@ ;; Author: Tim Vaughan ;; Created: 11 April 2019 -;; Version: 2.9.0 +;; Version: 2.9.1 ;; Keywords: comm gopher ;; Homepage: http://thelambdalab.xyz/elpher ;; Package-Requires: ((emacs "26.2")) @@ -71,7 +71,7 @@ ;;; Global constants ;; -(defconst elpher-version "2.9.0" +(defconst elpher-version "2.9.1" "Current version of elpher.") (defconst elpher-margin-width 6 @@ -286,9 +286,23 @@ some servers which do not support IPv6 can take a long time to time-out." ;; Gemini defaults (if (equal (url-filename url) "") (setf (url-filename url) "/")))) - url) + (elpher-remove-redundant-ports url)) (set-match-data data)))) +(defun elpher-remove-redundant-ports (address) + "Remove redundant port specifiers from ADDRESS. +Here 'redundant' means that the specified port matches the default +for that protocol, eg 70 for gopher." + (if (and (not (elpher-address-special-p address)) + (eq (url-portspec address) ; (url-port) is too slow! + (pcase (url-type address) + ("gemini" 1965) + ((or "gopher" "gophers") 70) + ("finger" 79) + (_ -1)))) + (setf (url-portspec address) nil)) + address) + (defun elpher-make-gopher-address (type selector host port &optional tls) "Create an ADDRESS object using gopher directory record attributes. The basic attributes include: TYPE, SELECTOR, HOST and PORT. @@ -784,7 +798,7 @@ are also deleted." (when elpher-client-certificate (unless (and (called-interactively-p 'any) (not (y-or-n-p (concat "Really forget client certificate? " - "(Throwaway certertificates will be deleted.)")))) + "(Throwaway certificates will be deleted.)")))) (when (cadr elpher-client-certificate) (delete-file (elt elpher-client-certificate 2)) (delete-file (elt elpher-client-certificate 3))) @@ -1274,10 +1288,10 @@ For instance, the filename /a/b/../c/./d will reduce to /a/c/d" (url-filename address))))) (unless (url-type address) (setf (url-type address) "gemini")) - (if (equal (url-type address) "gemini") - (setf (url-filename address) - (elpher-collapse-dot-sequences (url-filename address))))) - address)) + (when (equal (url-type address) "gemini") + (setf (url-filename address) + (elpher-collapse-dot-sequences (url-filename address))))) + (elpher-remove-redundant-ports address))) (defun elpher-gemini-insert-link (link-line) "Insert link described by LINK-LINE into a text/gemini document." @@ -1455,6 +1469,7 @@ The result is rendered using RENDERER." " - R: reload current page (regenerates cache)\n" " - S: set character coding system for gopher (default is to autodetect)\n" " - T: toggle TLS gopher mode\n" + " - F: forget/discard current TLS client certificate\n" " - .: display the raw server response for the current page\n" "\n" "Start your exploration of gopher space and gemini:\n")