# Teaching Emacs about Gemini Earlier this week I wrote a big dump of an article on here: => https://portal.mozz.us/gemini/gemlog.blue/users/acdw/1597092336.gmi "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: ``` code: elisp (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: ``` code: elisp (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 => https://www.emacswiki.org/emacs/Integrate_Gopher_and_Gemini_into_Eww_using_Elpher Emacswiki page on integrating gopher and gemini into eww gemini://gem.acdw.net:1965/raw/2020-08-13-Teaching-Emacs-about-Gemini

-- Leo's gemini proxy

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

-- Connected

-- Sending request

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

-- Response ended

-- Page fetched on Fri May 17 12:10:41 2024