Fork me on GitHub
#emacs
<
2023-02-18
>
pavlosmelissinos08:02:30

I love emacs but hate writing emacs-lisp. Has anyone tried to translate some of the clojure.core goodies to emacs-lisp? I think what I'm missing the most are data structure literals, string operations and data transformation functions (e.g. assoc/merge/into).

hifumi12309:02:54

I almost always (require 'cl) whenever i use elisp since theres just not enough time or interest for me to learn the elisp way of doing things 😄 keep in mind such libraries have subtle bugs though

pavlosmelissinos09:02:42

Hey, thank you both! dash was actually the reason I asked the question 🙂 To be frank, I'd love to be able to use {} and [] for maps/vectors. I don't think dash provides that but the functions look quite useful. I definitely don't need all of it but I'll probably do a surgical operation if that's ok with you @U07FCNURX, with proper attribution of course. The fact that cl is built-in is a plus as I'm trying to focus on minimalism. I'll weigh my options, thank you both! 🙂

hifumi12309:02:14

I wouldn’t worry about requiring s.el because most packages already do. There is a decent chance you already have it as a transitive dependency

👍 4
teodorlu14:02:59

Another approach is doing the grunt work in a babashka script, and shelling out to that from Emacs Lisp. https://github.com/clojure-emacs/parseedn lets you work with EDN data from Emacs Lisp. See for example https://github.com/teodorlu/neil-quickadd/blob/master/neil-quickadd.el for a light approach to shelling out to babashka.

👀 2
pavlosmelissinos15:02:28

Sounds promising, thanks. I was just thinking that what I really want is babashka sci emacs but this is probably better (because you still have access to the existing ecosystem)

teodorlu15:02:53

"sci for emacs lisp" sure gets me thinking too! :thinking_face:

teodorlu15:02:35

Here's something more magical: "write Clojure as Emacs Lisp forms". And it does have some subtle bugs that I don't know how to fix. Instead I'd prefer to put time into babashka scripts, and Emacs Lisp interop through parseedn. Though I've been using M-x t-edn-pretty a bit 🙂

Benjamin18:02:27

where clojure is strong with data structures, emacs is strong with buffers, points (markers), rendering text. But yea there is a place where you start using hashmaps for performance and it stops being so nice.

👍 4
jjttjj20:02:39

i've lightly experimented with another approach where I run a tcp server which processes emacs lisp (described here: https://emacs.stackexchange.com/questions/39027/how-to-control-emacs-externally) , and connecting to it from clojure, so I can do some logic in clojure but then just output emacs lisp commands. I haven't gone very far with this but it seems potentially promising

👀 4
jjttjj20:02:41

I think this project might take that concept a bit further but I haven't properly tried it out yet https://github.com/clojure-emacs/clomacs. Two way clojure to emacs communication seems like it could be nice for doing complex things. But just the basic tcp server is nice for letting you write a clojure library that you can include in your dev environments that lets you open emacs files from your clojure repl

👀 2
Clojuri0an23:03:09

True sigmas transcompile elisp to clojure