Teaching Emacs about Gemini

Earlier this week I wrote a big dump of an article on here:

=> "Long weekend"

and in it I included some of my Emacs/elpher/gemini woes, notably that I couldn't just click on a gemini link while writing up gemini URLs and it open it up in elpher.

Well, a few days later I got help from cyanocitta over at SDF.org to the tune of this:

Reading your post on emacs woes regarding browse-url-at-point I thought I might be able to provide a bit of help. There are two parts that are likely giving you trouble with the snippet you posted.
The browse-url-* functions tend to take a "rest" argument which typically denotes "new-window", you can ignore this as long as you handle the argument:
  (defun browse-url-elpher (url &rest args)
    "Ask elpher to load a URL.
    Defaults to URL around or before point."
    (interactive (browse-url-interactive-arg "URL: "))
    (setq url (browse-url-encode-url url))
    (require 'elpher)
    (elpher-go url))
Secondly, and slightly more annoying, calling browse-url-interactive-arg winds (eventually) through browse-url-url-at-point which will check for a valid URI and, failing that, prepend "http://". It so happens that "gopher://" is a known URI scheme, so you'll only have to handle "gemini://". This is possible with:
  (require 'thingatpt)
  (push "gemini://" thing-at-point-uri-schemes)

I tried these suggestions and they worked perfectly! Thanks, cyanocitta!

Well... almost perfectly. I still can't click on the links for them to open, I have to M-x browse-url-at-point. But I'm pretty sure I can fix that easily; I just haven't got around to it yet.

Further reading

=> Emacswiki page on integrating gopher and gemini into eww

Proxy Information
Original URL
gemini://gemlog.blue/users/acdw/1597354552.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
679.270226 milliseconds
Gemini-to-HTML Time
0.972146 milliseconds

This content has been proxied by September (3851b).