If elpher-go is the first thing you do, and no *elpher* buffer exists,
you run into an error. Wrapping elpher-visit-page in
elpher-with-clean-buffer fixes this, as this sets up the *elpher*
buffer, and sets elpher-mode.
Alternatively, we could also just set elpher-mode. The key is that we
must do it before elpher-visit-page is called, otherwise this is what
happens: elpher-go → elpher-visit-page → elpher-render-gemini via
elpher-type-map → elpher-render-gemini-map → elpher-with-clean-buffer
which now calls elpher-mode, wiping all the local variables. If,
however, we make sure elpher-mode is active before all of this,
elpher-with-clean-buffer when called from elpher-render-gemini-map
will not call elpher-mode and the local variables remain set.
(address (elpher-address-from-url cleaned-host-or-url))
(page (elpher-make-page cleaned-host-or-url address)))
(switch-to-buffer elpher-buffer-name)
- (elpher-visit-page page)
+ (elpher-with-clean-buffer
+ (elpher-visit-page page))
nil))
(defun elpher-go-current ()