From a29c98cf4d17b09060d923f2e9e2510563027c7a Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Wed, 13 May 2020 10:17:03 +0200 Subject: [PATCH] Adding finger support. --- ISSUES.org | 17 ++++++++++++----- elpher.el | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ISSUES.org b/ISSUES.org index 2b637c0..4624786 100644 --- a/ISSUES.org +++ b/ISSUES.org @@ -14,11 +14,6 @@ this can happen: - [X] shift history out of node tree and into separate stack - [ ] make history stack variables buffer-local - [ ] have elpher-with-clean-buffer select appropriate buffer - -** OPEN Remove "redraw" command -This is only necessary for returning from displaying the raw -server response. If I can provide a better way of doing that -then we can get rid of redraw entirely. ** OPEN Replace support for user-specified starting pages This used to be available, but was removed during a refactor. @@ -46,6 +41,10 @@ Here is the checklist of features required before release: The last few will be made infinitely easier if we factor the gopher "getter" code differently. +** OPEN Implement Finger support + +** OPEN Add history browsing + * Bugs * Completed improvements @@ -108,6 +107,14 @@ do, but will process the URL to do it. This also means that non-gopher URLs will be explicitly represented as such: no more abusing the "h" type for these. +** INVALID Remove "redraw" command +This is only necessary for returning from displaying the raw +server response. If I can provide a better way of doing that +then we can get rid of redraw entirely. + +Actually, this command can be useful to correct rendering issues that +occasionally pop up in termal windows. Lets leave it for now. + * Closed issues ** CLOSED Org mode faces are not present in recent emacs versions diff --git a/elpher.el b/elpher.el index 474eee1..4feb520 100644 --- a/elpher.el +++ b/elpher.el @@ -89,6 +89,7 @@ ((gopher ?s) elpher-get-gopher-page elpher-render-download "snd" elpher-binary) ((gopher ?h) elpher-get-gopher-page elpher-render-html "htm" elpher-html) (gemini elpher-get-gemini-page elpher-render-gemini "gem" elpher-gemini) + (finger elpher-get-finger-page elpher-render-text "txt" elpher-text) (telnet elpher-get-telnet-page nil "tel" elpher-telnet) (other-url elpher-get-other-url-page nil "url" elpher-other-url) ((special bookmarks) elpher-get-bookmarks-page nil "/" elpher-index) @@ -1030,6 +1031,26 @@ For instance, the filename /a/b/../c/./d will reduce to /a/c/d" (elpher-page-address elpher-current-page) (buffer-string)))) +;; Finger page connection + +(defun elpher-get-finger-page (renderer) + "Opens a finger connection to the current page address and renders it using RENDERER." + (let* ((address (elpher-page-address elpher-current-page)) + (host (elpher-address-host address)) + (port (elpher-address-port address)) + (content (elpher-get-cached-content address))) + (if (and content (funcall renderer nil)) + (elpher-with-clean-buffer + (insert content) + (elpher-restore-pos)) + (elpher-with-clean-buffer + (insert "LOADING... (use 'u' to cancel)")) + (condition-case the-error + (elpher-get-selector address renderer) + (error + (elpher-network-error address the-error)))))) + + ;; Other URL page opening (defun elpher-get-other-url-page (renderer) -- 2.20.1