From: Tim Vaughan Date: Mon, 22 Apr 2019 09:21:00 +0000 (+0200) Subject: Search now working. X-Git-Tag: v1.0.0~59 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=elpher.git;a=commitdiff_plain;h=e4a1133e92854a9973e24c6441146c4a406f4a27 Search now working. --- diff --git a/elopher.el b/elopher.el index a9c4661..959bc68 100644 --- a/elopher.el +++ b/elopher.el @@ -328,22 +328,28 @@ sentinal function." (defun elopher-get-search-node () (let* ((content (elopher-node-content elopher-current-node)) - (address (elopher-node-address elopher-current-node)) - (search-address (elopher-make-address (concat (elopher-address-selector address) - "\t" - (read-from-minibuffer "Query: ")) - (elopher-address-host address) - (elopher-address-port address)))) - (let ((inhibit-read-only t)) - (insert "LOADING RESULTS...")) - (elopher-get-selector search-address - (lambda (proc event) - (let ((inhibit-read-only t)) - (erase-buffer) - (elopher-insert-index elopher-selector-string)) - (elopher-restore-pos) - (elopher-set-node-content elopher-current-node - (buffer-string)))))) + (address (elopher-node-address elopher-current-node))) + (if content + (progn + (let ((inhibit-read-only t)) + (insert content)) + (elopher-restore-pos) + (message "Displaying cached search results. Reload to perform a new search.")) + (let* ((inhibit-read-only t) + (query-string (read-from-minibuffer "Query: ")) + (query-selector (concat (elopher-address-selector address) "\t" query-string)) + (search-address (elopher-make-address query-selector + (elopher-address-host address) + (elopher-address-port address)))) + (insert "LOADING RESULTS...") + (elopher-get-selector search-address + (lambda (proc event) + (let ((inhibit-read-only t)) + (erase-buffer) + (elopher-insert-index elopher-selector-string)) + (goto-char (point-min)) + (elopher-set-node-content elopher-current-node + (buffer-string)))))))) ;;; Navigation procedures