💾 Archived View for gemlog.blue › users › acdw › 1597354552.gmi captured on 2020-09-24 at 00:42:40. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Earlier this week I wrote a big dump of an article on here:
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.