-- Leo's gemini proxy

-- Connecting to gem.acdw.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; charset=UTF-8

2020-08-13-Teaching-Emacs-about-Gemini

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



~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Copyright (c) 2019-2020 Case Duckworth. CC-BY-SA.

History

Raw

HTML

-- Response ended

-- Page fetched on Thu May 2 15:35:42 2024