+ (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-process-text 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))))))))
+
+;; Raw server response retrieval
+
+(defun elopher-get-node-raw ()
+ (let* ((content (elopher-node-content elopher-current-node))
+ (address (elopher-node-address elopher-current-node)))
+ (elopher-with-clean-buffer
+ (insert "LOADING RAW SERVER RESPONSE..."))
+ (if address
+ (elopher-get-selector address
+ (lambda (proc event)
+ (elopher-with-clean-buffer
+ (insert elopher-selector-string))
+ (goto-char (point-min))))
+ (progn
+ (elopher-with-clean-buffer
+ (insert elopher-start-index))
+ (goto-char (point-min)))))
+ (message "Displaying raw server response. Reload to return to standard view."))
+
+
+;; File export retrieval
+
+(defvar elopher-download-filename)
+
+(defun elopher-download-node (node filename)
+ (let* ((address (elopher-node-address node)))
+ (message "Downloading...")
+ (setq elopher-download-filename filename)
+ (elopher-get-selector address
+ (lambda (proc event)
+ (let ((coding-system-for-write 'binary))
+ (with-temp-file elopher-download-filename
+ (insert elopher-selector-string)))
+ (message (format "Download complate, saved to file %s."
+ elopher-download-filename))))))
+
+;;; Navigation procedures