- (let ((inhibit-read-only t))
- (insert content))
- (elopher-get-selector address
- (lambda (proc event)
- (let ((inhibit-read-only t))
- (erase-buffer)
- (insert elopher-selector-string))
- (elopher-set-node-content elopher-current-node
- elopher-selector-string))))))
-
-;;; Navigation methods
+ (progn
+ (elopher-with-clean-buffer
+ (insert content))
+ (elopher-restore-pos))
+ (progn
+ (elopher-with-clean-buffer
+ (insert "LOADING TEXT..."))
+ (elopher-get-selector address
+ (lambda (proc event)
+ (elopher-with-clean-buffer
+ (insert (elopher-strip-CRs elopher-selector-string)))
+ (elopher-restore-pos)
+ (elopher-set-node-content elopher-current-node
+ (buffer-string))))))))
+
+;; Image retrieval
+
+(defun elopher-get-image-node ()
+ (let ((content (elopher-node-content elopher-current-node))
+ (address (elopher-node-address elopher-current-node)))
+ (if content
+ (progn
+ (elopher-with-clean-buffer
+ (insert-image content))
+ (setq cursor-type nil)
+ (elopher-restore-pos))
+ (progn
+ (elopher-with-clean-buffer
+ (insert "LOADING IMAGE..."))
+ (elopher-get-selector address
+ (lambda (proc event)
+ (let ((image (create-image
+ (string-as-unibyte elopher-selector-string)
+ nil t)))
+ (elopher-with-clean-buffer
+ (insert-image image))
+ (setq cursor-type nil)
+ (elopher-restore-pos)
+ (elopher-set-node-content elopher-current-node image))))))))
+
+;; Search retrieval
+
+(defun elopher-get-search-node ()
+ (let* ((content (elopher-node-content elopher-current-node))
+ (address (elopher-node-address elopher-current-node)))
+ (if content
+ (progn
+ (elopher-with-clean-buffer
+ (insert content))
+ (elopher-restore-pos)
+ (message "Displaying cached search results. Reload to perform a new search."))
+ (let* ((query-string (read-string "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))))
+ (elopher-with-clean-buffer
+ (insert "LOADING RESULTS..."))
+ (elopher-get-selector search-address
+ (lambda (proc event)
+ (elopher-with-clean-buffer
+ (elopher-insert-index elopher-selector-string))
+ (goto-char (point-min))
+ (elopher-set-node-content elopher-current-node
+ (buffer-string))))))))
+
+
+;;; Navigation procedures