From 42b79ed99012e13fb25ce47a59272c20ab3f5d18 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Fri, 12 Apr 2019 13:35:35 +0200 Subject: [PATCH] Can retrieve index files from gopher servers. --- elopher.el | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/elopher.el b/elopher.el index fd0e910..b28120b 100644 --- a/elopher.el +++ b/elopher.el @@ -12,31 +12,38 @@ ;; (define-derived-mode elopher-mode special-mode "elopher" ;; "Major mode for elopher, an elisp gopher client.") -(defvar my-marker nil) +(defun ) -(defun my-filter (proc string) +(defun elopher-filter (proc string) (with-current-buffer (get-buffer "*elopher*") (let ((marker (process-mark proc))) (if (not (marker-position marker)) (set-marker marker 0 (current-buffer))) (save-excursion (goto-char marker) - (insert (propertize string 'face '(foreground-color . "yellow"))) + (insert (propertize string 'face '(foreground-color . "magenta"))) (set-marker marker (point)))))) +(defun elopher-get-index (host &optional port path) + (switch-to-buffer-other-window "*elopher*") + (erase-buffer) + (make-network-process + :name "elopher-process" + :host host + :service (if port port 70) + :filter #'elopher-filter) + (process-send-string "elopher-process" (format "%s\n" (if path path "")))) (defun elopher () "Start gopher client." (interactive) - (switch-to-buffer-other-window "*elopher*") - (setq my-marker (make-marker)) - (erase-buffer) - (make-process - :name "date" - :command (list "/bin/ls" "-l" "/") - :filter #'my-filter)) + (elopher-get-index (read-from-minibuffer "Gopher host: ") 70)) + +(elopher-get-index "cosmic.voyage") + +(format "%s\n" nil) -(elopher) +(delete-process "elopher-process") ;; (address (read-from-minibuffer "Address of gopher server: "))) ;; (message "Connecting to '%s' ..." address) -- 2.20.1