From 7f807b93bfabc32fcf5e17d81511d6bfdbba3acd Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Sun, 21 Apr 2019 09:27:48 +0200 Subject: [PATCH] Functional again. --- elopher.el | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/elopher.el b/elopher.el index 40e4ef1..812ebb4 100644 --- a/elopher.el +++ b/elopher.el @@ -28,6 +28,7 @@ "i - RET/mouse-1: open directory entry\tfake\tfake\t1" "i - u: return to parent directory entry\tfake\tfake\t1" "i - g: go to a particular site\tfake\tfake\t1" + "i - r: reload current page\tfake\tfake\t1" "i\tfake\tfake\t1" "iPlaces to start exploring Gopherspace:\tfake\tfake\t1" "1Floodgap Systems Gopher Server\t\tgopher.floodgap.com\t70" @@ -95,6 +96,8 @@ (defun elopher-set-node-content (node content) (setcar (cdddr node) content)) +;; Node graph traversal + (defvar elopher-start-node (elopher-make-node nil nil #'elopher-get-index-node)) (defvar elopher-current-node) @@ -202,37 +205,47 @@ (let ((content (elopher-node-content elopher-current-node)) (address (elopher-node-address elopher-current-node))) (if content - (insert content) + (let ((inhibit-read-only t)) + (save-excursion + (insert content))) (if address (elopher-get-selector address (lambda (proc event) (let ((inhibit-read-only t)) (erase-buffer) - (elopher-insert-index elopher-selector-string)) + (save-excursion + (elopher-insert-index elopher-selector-string))) (elopher-set-node-content elopher-current-node (buffer-string)))) (progn (let ((inhibit-read-only t)) (erase-buffer) - (elopher-insert-index elopher-start-page)) + (save-excursion + (elopher-insert-index elopher-start-page))) (elopher-set-node-content elopher-current-node (buffer-string))))))) ;; Text retrieval +(defun elopher-strip-CRs (string) + (replace-regexp-in-string "\r" "" string)) + (defun elopher-get-text-node () (let ((content (elopher-node-content elopher-current-node)) (address (elopher-node-address elopher-current-node))) (if content (let ((inhibit-read-only t)) - (insert content)) + (save-excursion + (insert content))) (elopher-get-selector address (lambda (proc event) (let ((inhibit-read-only t)) (erase-buffer) - (insert elopher-selector-string)) + (save-excursion + (insert + (elopher-strip-CRs elopher-selector-string)))) (elopher-set-node-content elopher-current-node - elopher-selector-string)))))) + (buffer-string))))))) ;;; Navigation methods ;; -- 2.20.1