good morning
Good morning, too
mogge
Good morning 🧊
morning
Morning
Good Morning!
Good morning!
good morning
Morning!
I'm starting to believe that inventing a light hypermedia protocol is a good idea to avoid writing Emacs lisp, and write Babashka instead. If that's a bad idea, I might need some telling.
I needed a little time to gather my thoughts here 😅😄 And the response turned out lengthy anyway. My ideas about this are still quite fuzzy. My need for this stems from a couple of observations. I've made several one-off Emacs Lisp scripts that do a little thing in my projects. For example creating new pages on my website, and creating links to pages on my website. They are great — they get me a step towards a more interactive experience working on my source. However, (a) I loose track of which UI's I've made, (b) the source of these tiny Emacs Lisp UIs know a great deal about which Babashka tasks / scripts they have to call. In the end, I forget about them, or I make changes to the code and they suddenly stop working. I change the Babashka side, and the Emacs side stops working. I can't cover client side logic with Babashka/Clojure tests. This sounds terribly similar to the problems one gets with the server in one language (eg PHP) and a Javascript bundle that knows a lot (too much) about server internals. On the web, we have a solution to this, hypermedia. The server knows the domain model and the logic, and the client focuses on hypermedia controls only. So let's do a little exaptation. Babashka is the server, and Emacs Lisp is "just" a dumb hypermedia client. My first version would need (a) an input text control, (b) a select between options control, and (c) a way to display a message. I think the central design problem here is the hypermedia protocol. I want it to be EDN centric, but clients shouldn't care about EDN. My draft is this:
EDN_HEADER\n
\n
CONTROL_1
CONTROL_2
Where each control is a tab separated list.
Input text control:
:input{:action :set-name}What is your name?
Select between options control:
:option{:action :set-site :site/url ""}Wikipedia
:option{:action :set-site :site/url " "}Lu Wilson's Wikibloggarden
I haven't yet drafted the text that should be sent from the client back to the server.
---
The funny feeling I've got is, this seems sort of obvious, so why haven't anyone made it already? I guess Babashka is kind of young. And essential, to provide EDN-niceness. We don't want to wait for a JVM process startup between each UI choice. But Babashka is definitely fast enough. And with Invoker (https://github.com/filipesilva/invoker), we get a hook from Babashka into our running JVM process.
The future of my many throwaway Emacs Lisp scripts, I hope, is to have the logic move to the server as small state machines, and a generic hypermedia-bb Emacs library that provides the UI controls without caring about opaque EDN strings that it just helps carry.you could just use the nREPL client/server architecture directly maybe?
Good question. I don't know quite how that works, I'll have a look!
I mean if you want to have some kind of RPC you may just want to startup a babashka nrepl and talk to it through nrepl.el or whatever
And the advantage of building on nREPL is that I don't have to invent a protocol? It would require that the client knows "how to speak nREPL", which Emacs (nrepl.el) and Babashka/JVM Clojure already do.
I built an emacs loadable module with sci in it awhile ago so I could just write emacs stuff in-process using Clojure. It didn't end up feeling better to me than just writing things in elisp.
Scimacs, I presume?
Lack of Emacs experience is likely a factor. I'm just not as comfortable as I am with Clojure.
Say more.