Allow elpher-go to work without an Elpher ebuffer
authorAlex Schroeder <alex@gnu.org>
Tue, 6 Jul 2021 17:31:32 +0000 (19:31 +0200)
committerAlex Schroeder <alex@gnu.org>
Tue, 6 Jul 2021 17:31:32 +0000 (19:31 +0200)
commitb6f31ac74fe81e300dbae73137f511f5d93c3c0d
tree399fe09e0164fa88505660b99256e49237f76e1b
parentb247a2fed578b0c7f819c65423e955126c3d17b3
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.
elpher.el