Short question, before I start wasting time: there is no Reticulum related Emacs software existing... or does anybody know or even work on something?
Because if not I think I really want to write at least a simple lxmf client for Emacs.
Started by Rudi Mentaire 756c9adefd2ed337... ·
Short question, before I start wasting time: there is no Reticulum related Emacs software existing... or does anybody know or even work on something?
Because if not I think I really want to write at least a simple lxmf client for Emacs.
Ok, so, at least three people here caring about Emacs? Nice!
I am not yet sure how the optimal basic architechture would look like. I have very good Lisp skills but no python experience. Would I rather use a small python skript as glue code communicating with Emacs, or would I rather just envoke a plain python process from within Emacs and process-send-string stuff to it? All Emacs programs envoking python code I found run python in interactive interpreter mode (mostly using comint), and then parse the prompts away etc, ugh. I don't want to reimplement the complete lxmf implementation in Elisp.
Is there a more elegant way to do this?
The actual UI in Emacs should not be hard to do, as well as supporting different identities. I think I would need a separate lxmf router instance running for every identity/address though.
Yeah, and a nomadnet browser integrating into eww would also be nice, but AFAIK we have no micron->html converter in the reference implementation, and in the nomadnet program the micron parser is not really factored out so that I could not really reuse it for rendering :-( and would have to reimplement all gory details. In addition, I think there is no basic tool for fetching contents from a nomadnet address. But nomadnet the program is already nice, and maybe this part is not so important.
I wrote an org exporter for micron: https://codeberg.org/qbit/ox-micron (took the rngit mirror off line for now, scrappers were killing things)
You can publish via rnsh.
To show something concrete, here is an (ugly) template that sets things up up to the point where a router for an identity is started. It feels very dirty to mix python variables and Elisp variables/setup like that, so I would at least want to keep this ugly glue code part as minimal as possible, and implement everything else in Elisp alone (using few well defined interface functions). Anybody with a better approach?
;;; lxmf-client.el --- LXMF Client for Emacs -*- lexical-binding: t -*-
;;;; !!! THIS IS ONLY A MINIMAL DRAFT AND PLAY AREA !!!
;;;; Helpers
(defun lxmf-client-make-python-process ()
(make-process :buffer nil :name "lxmf-client" :command '("python" "-i")
:filter #'lxmf-client-process-filter
:stderr "*LXMF Errors*"))
(defun lxmf-client-send (p s)
(process-send-string p (concat s "\n")))
(defun lxmf-client-process-filter (p s)
(ignore p) ;implement me...
(message "Received: %s" s))
;;;; Main Stuff
(defun lxmf-client-init (p)
(lxmf-client-send p "\
import RNS
import LXMF
RNS.Reticulum(loglevel=RNS.LOG_VERBOSE)"))
(defun lxmf-client-load-identity (p identity-file display-name)
(lxmf-client-send p (format "\
def identity_from(id_path):
RNS.log('Loaded identity from file', RNS.LOG_INFO)
return RNS.Identity.from_file(id_path)
local_identity = identity_from(\"%s\")
configdir = \"%s\" + RNS.prettyhexrep(local_identity.hash)
message_router = LXMF.LXMRouter(identity = local_identity, storagepath = configdir)
local_lxmf_destination = message_router.register_delivery_identity(local_identity, display_name=\"%s\")"
identity-file
(expand-file-name "~/.emacs-lxmf-client/")
display-name)))
(defun lxmf-client-announce (p)
(lxmf-client-send p "local_lxmf_destination.announce()"))
(provide 'lxmf-client)
;;; lxmf-client.el ends here
If you know how to do it better, please speak up so that I don't continue with an unnecessary mess. Apart from that, I really look forward to writing this. Comments, ideas and wishes appreciated. So far I'm still making up my mind.
@qbit Our posts crossed. Cool, I will definitely have a look.
Edit: Nice. So we don't start at zero (although for my case it is "the wrong direction"). Also thanks for sharing the tramp setup.
Rudi Mentaire wrote:
a nomadnet browser integrating into eww would also be nice, but AFAIK we have no micron->html converter in the reference implementation
Maybe elpher would be a better target, as it can handle both gopher & gemini (and also finger), so adding a new protocol might be simpler.
Rudi Mentaire wrote:
...
Yeah, and a nomadnet browser integrating into eww would also be nice, but AFAIK we have no micron->html converter in the reference implementation, and in the nomadnet program the micron parser is not really factored out so that I could not really reuse it for rendering :-( and would have to reimplement all gory details. ...
https://github.com/RFnexus/micron-parser-js exists for converting micron to html
@Kefir Thanks for commenting! This is definitely something to consider. eww deligates fetching to ʼbrowse-urlʼ. In theory, if that would deliver something with content-type html (which should be possible in theory, i.e. we would instruct browse-url to do a transparent transformation micron - html for a certain kind of addresses) then we could use eww. For retrieved non-html contents eww just falls back to other tools and not open a dedicated eww buffer AFAIK. Elpher might be the more appropriate frontend, I dunno. eww would have the advantage to be built-in, that's why I would prefer it if it's doable I think.
Rudi Mentaire wrote:
@Kefir Thanks for commenting!
Oh, I'm just one of those annoying idea guys who is happy someone actually wants to work on emacs support.
Rudi Mentaire wrote:
eww would have the advantage to be built-in, that's why I would prefer it if it's doable I think.
You should consider that you'd have to convince the maintainers of baseline emacs to add reticulum support to eww if you want to leverage that it's built-in, otherwise a user has to install a package to add reticulum support to eww anyway. And the former seems to be quite a hurdle to me. Meanwhile elpher is one of those "anything but http(s)" browsers designed to work with protocols simple enough for the terminal, so I think the devs would be fine with a pull request to add yet one more markup language.