💾 Archived View for ew.srht.site › en › 2021 › 20210905-elpher-revisited.gmi captured on 2024-05-26 at 14:48:20. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

➡️ Next capture (2024-06-16)

-=-=-=-=-=-=-

2021-09-05

elpher, revisited

tags: gemini software

Some time ago I wrote about elpher

gemini://ew.srht.site/en/2021/20210804-elpher-wishlist.gmi

gemini://ew.srht.site/en/2021/20210805-re-elpher.gmi

These days Tim (maintainer of elpher) sent me a message, basically explaining that I tried to make sense of elpher in the middle of some bigger commits happening. That's very kind of him, isn't it?

So I took another round reading up and fiddling with emacs, the straight package manager and elpher. Along the way I found a few more useful keybindings and I wrote my first elisp function.

Change the code repository back to thelambdalab

I had resorted to Alex Schröders copy of the code repository. Now I changed it back. However, I had to delete the elpher directories in ~/.emacs.d/straight/{repos,build} --- otherwise the switch wasn't picked up.

Change the start page

Turns out that elpher has a variable to set the page you want to see upon start. It's called elpher-start-page-url and it's initial value is "about:welcome". Also turns out, that Tim had added support for "file:" URLs during that time. So I changed elpher-start-page-url to point to a file, which I had written to my liking: a list of links in my preferred order plus some annotations. So whenever I call elpher this list is shown initially.

(setq elpher-start-page-url "file:~/path/to/my-bookmarks.gmi")

So while this is fine, pressing "B" brings up the emacs bookmarks system with a list of elpher bookmarks. I'm still not friends with that, mostly for its ordering. So I decided to add a key to jump to my-bookmarks.gmi

Add key "H" to jump to my-bookmarks.gmi

Now, this is a first. I wrote my first function in elisp. Digging in the Info system, variable values and function definitions, I looked at the code of elpher-go. This function was used as an inspiration to actually show my-bookmarks.gmi:

(defun ew/elpher-go-home ()
  "Go to my start page."
  (interactive)
  (elpher-visit-page (elpher-page-from-url elpher-start-page-url)))

Now this new and shiny function is mapped to "H" while in elpher mode. The :bind pragma nicely takes care of this. See below for the full code snippet.

Keybindings found along the way

As my friend H nicely says: "Doku lesen bildet!" --- Reading (even documentation!) expands the mind. Yes indeed, it does. While skimming the elpher info page for insights I came across a number of key bindings I did not know.

So I'm an even more happy user of elpher. Thanks to Tim Vaughan, Alex Schröder and all the others making this possible!

Cheers,

~ew

Code Snippet

License: CC0 -- recycle to your liking
; --- elpher ---------------------------------------------------------
(straight-use-package
 '(elpher
   :type git
   :repo "https://thelambdalab.xyz/git/elpher.git" :branch "master"
;; :repo "https://alexschroeder.ch/cgit/elpher"
   ))
(use-package elpher
  :straight t
  :demand t
  :config
  (defun ew/elpher-go-home ()
    "Go to my start page."
    (interactive)
    (elpher-visit-page (elpher-page-from-url elpher-start-page-url)))
  (setq elpher-start-page-url "file:~/path/to/my-bookmarks.gmi" )
  :bind ( :map elpher-mode-map
               ("H" . ew/elpher-go-home)
         )
  )

Home