(defmacro elpher-with-clean-buffer (&rest args)
"Evaluate ARGS with a clean *elpher* buffer as current."
- (list 'progn
- '(switch-to-buffer "*elpher*")
+ (list 'with-current-buffer "*elpher*"
'(elpher-mode)
(append (list 'let '((inhibit-read-only t))
'(erase-buffer))
(if content
(progn
(elpher-with-clean-buffer
- (insert content))
- (elpher-restore-pos))
+ (insert content)
+ (elpher-restore-pos)))
(if address
(progn
(elpher-with-clean-buffer
(lambda (proc event)
(unless (string-prefix-p "deleted" event)
(elpher-with-clean-buffer
- (elpher-insert-index elpher-selector-string))
- (elpher-restore-pos)
- (elpher-set-node-content elpher-current-node
- (buffer-string))))))
+ (elpher-insert-index elpher-selector-string)
+ (elpher-restore-pos)
+ (elpher-set-node-content elpher-current-node
+ (buffer-string)))))))
(progn
(elpher-with-clean-buffer
- (elpher-insert-index elpher-start-index))
- (elpher-restore-pos)
- (elpher-set-node-content elpher-current-node
- (buffer-string)))))))
+ (elpher-insert-index elpher-start-index)
+ (elpher-restore-pos)
+ (elpher-set-node-content elpher-current-node
+ (buffer-string))))))))
;; Text retrieval
(if content
(progn
(elpher-with-clean-buffer
- (insert content))
- (elpher-restore-pos))
+ (insert content)
+ (elpher-restore-pos)))
(progn
(elpher-with-clean-buffer
(insert "LOADING TEXT..."))
(lambda (proc event)
(unless (string-prefix-p "deleted" event)
(elpher-with-clean-buffer
- (insert (elpher-process-text elpher-selector-string)))
- (elpher-restore-pos)
- (elpher-set-node-content elpher-current-node
- (buffer-string)))))))))
+ (insert (elpher-process-text elpher-selector-string))
+ (elpher-restore-pos)
+ (elpher-set-node-content elpher-current-node
+ (buffer-string))))))))))
;; Image retrieval
(if content
(progn
(elpher-with-clean-buffer
- (insert-image content))
- (setq cursor-type nil)
- (elpher-restore-pos))
+ (insert-image content)
+ (elpher-restore-pos)))
(if (display-images-p)
(progn
(elpher-with-clean-buffer
'no-conversion)
nil t)))
(elpher-with-clean-buffer
- (insert-image image))
- (setq cursor-type nil)
- (elpher-restore-pos)
+ (insert-image image)
+ (elpher-restore-pos))
(if elpher-cache-images
(elpher-set-node-content elpher-current-node
image)))))))
(if content
(progn
(elpher-with-clean-buffer
- (insert content))
- (elpher-restore-pos)
+ (insert content)
+ (elpher-restore-pos))
(message "Displaying cached search results. Reload to perform a new search."))
(unwind-protect
(let* ((query-string (read-string "Query: "))
(lambda (proc event)
(unless (string-prefix-p "deleted" event)
(elpher-with-clean-buffer
- (insert elpher-selector-string))
- (goto-char (point-min)))))
+ (insert elpher-selector-string)
+ (goto-char (point-min))))))
(progn
(elpher-with-clean-buffer
(insert elpher-start-index))
(defun elpher-go ()
"Go to a particular gopher site."
(interactive)
+ (switch-to-buffer "*elpher*")
(let* (
(hostname (read-string "Gopher host: "))
(selector (read-string "Selector (default none): " nil nil ""))
(defun elpher ()
"Start elpher with default landing page."
(interactive)
+ (switch-to-buffer "*elpher*")
(setq elpher-current-node nil)
(let ((start-node (elpher-make-node nil
elpher-start-address