From: Alex Schroeder Date: Tue, 6 Jul 2021 17:31:32 +0000 (+0200) Subject: Allow elpher-go to work without an Elpher ebuffer X-Git-Tag: v3.0.0~22^2~4 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=b6f31ac74fe81e300dbae73137f511f5d93c3c0d;p=elpher.git Allow elpher-go to work without an Elpher ebuffer 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. --- diff --git a/elpher.el b/elpher.el index 87729f5..50637b0 100644 --- a/elpher.el +++ b/elpher.el @@ -1935,7 +1935,8 @@ When run interactively HOST-OR-URL is read from the minibuffer." (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 ()