skeeto / elfeed

An Emacs web feeds client
The Unlicense
1.48k stars 116 forks source link

Elpheed support for Gemini protocol? #470

Open duncan-bayne opened 1 year ago

duncan-bayne commented 1 year ago

Hi :) I've been happily using Elfeed as my feed reader for years, but now that I'm exploring Gemini capsules as well I was thinking of raising a PR to add Gemini support to Elfeed.

Some initial reading suggests this might be non-trivial:

  1. curl doesn't support Gemini (see https://github.com/curl/curl/pull/6261), & elfeed seems to prefer (need?) curl on Windows.
  2. How to open Gemini URLs? Tight integration with elpher ( https://thelambdalab.xyz/elpher/ ) seems obvious but is probably wrong. On X I'd suggest using something like xdg-open. But then, what about Windows? Or macOS? Etc.
  3. How to test on Windows? I don't actually have a Windows box at home; probably easiest is a Windows EC2 instance. Either I grant @skeeto access to it, or you just have to take my word that it "works on my machine" ;)

@jtecca do you have any thoughts around these points? I see you were working on Gopher support a while back.

duncan-bayne commented 1 year ago

Re. 2, this approach by Xah Lee might work: http://xahlee.info/emacs/emacs/emacs_dired_open_file_in_ext_apps.html.

Could wind up being amusingly circular for some folks; browse the URL, pass through xdg-open, which calls back into Emacs to be handled by Elpher :rofl: So presumably this could be configurable - either call out or invoke elpher-go, or something.

jtecca commented 1 year ago

Hi @duncan-bayne, it's been a while since I last looked at the elfeed code, but the issues you laid out were what I was thinking of when I was working on the Gopher part of elfeed (which is merged and working, BTW). I had wanted to implement gopher and gemini at the same time, but went with gopher only because it was what I could finish with the time I had available.

The lack of native gemini support in curl was the main reason I only implemented gopher support on my PR.

Elfeed heavily relies on curl as the primary mode of cross-compatibility, otherwise relying on Emacs' url-retrieve. IIRC it's not currently designed to have some sort of context switch on curl/not curl based on the protocol -- it's a setting that defines how all feeds are retrieved when elfeed is invoked. You could potentially hack in some sort of context switch to call something like xdg-open but I think it would be brittle (and a literal hack) without rewriting a lot of the assumptions about how elfeed is designed.

If I had free time to work on this, I'd probably implement this as a separate extension package that requires both elfeed and elpher as requirements. It may be easier to write some glue code to call the elpher API to handle the protocol to grab documents from the feed and then tap in directly to the elfeed DB API to add entries to the database. The big downside to this is if skeeto makes any major changes to the DB API then you'll have breaking changes. Given that there hasn't been much updates to the codebase, you might be okay. I'd then plan to depricate this extension package as soon as gemini support lands in curl.

Good luck! This is something I'd use if you're able to work on it.