X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=elpher.git;a=blobdiff_plain;f=elpher.el;h=8230377430bcd1627b6bbd7ebd23ed740aaea257;hp=8940f087d8f37e0fe8a953b9ee8e3029adf89673;hb=42b70bca5bd23de3de35ec95a196d00cdf88dc61;hpb=79d8cf963148534c8ec23a9dbaa6db1325232d85 diff --git a/elpher.el b/elpher.el index 8940f08..8230377 100644 --- a/elpher.el +++ b/elpher.el @@ -106,6 +106,8 @@ (defvar elpher--gemini-page-links '() "Internal variable containing list of links on page.") +(defvar elpher--gemini-page-links-cache (make-hash-table :test 'equal) + "Internal variable containing hash of addresses and page links.") ;;; Customization group ;; @@ -469,12 +471,17 @@ unless NO-HISTORY is non-nil." (setq elpher-current-page page) (let* ((address (elpher-page-address page)) (type (elpher-address-type address)) - (type-record (cdr (assoc type elpher-type-map)))) + (type-record (cdr (assoc type elpher-type-map))) + (page-links nil)) (if type-record - (funcall (car type-record) - (if renderer - renderer - (cadr type-record))) + (progn + (funcall (car type-record) + (if renderer + renderer + (cadr type-record))) + (setq page-links (gethash address elpher--gemini-page-links-cache)) + (if page-links + (setq elpher--gemini-page-links page-links))) (elpher-visit-previous-page) (pcase type (`(gopher ,type-char) @@ -1435,7 +1442,11 @@ width defined by elpher-gemini-max-fill-width." (t (elpher-gemini-insert-text line))))) (elpher-cache-content (elpher-page-address elpher-current-page) - (buffer-string)))) + (buffer-string)) + (puthash + (elpher-page-address elpher-current-page) + elpher--gemini-page-links + elpher--gemini-page-links-cache))) (defun elpher-render-gemini-plain-text (data _parameters) "Render DATA as plain text file. PARAMETERS is currently unused."