reddit / emacs

How can I use a common lisp package within an elisp package? More details inside

chiathrowaway123 · 2022-12-27 02:11
So I am building an emacs client for Nostr, and am starting off with the key and signatures which use SECP256K1 from bitcoin. There is a lisp package: [https://github.com/dvush/cl-secp256k1](https://github.com/dvush/cl-secp256k1) which provides the ability to create keys and sign messages. I would like to be able to define some functions in my elisp file that would call certain methods from this package, say to create a private key. My question is really how to do this... is it even worth doing it this way, or just force the user to install a C implementation of the package and then get elisp to run that. Any thoughts or insights very much appreciated :)
chiathrowaway123 · 2022-12-27 02:50
This is getting downvoted so I guess it's not how we're supposed to use elisp. Pity because it would be cool to have a nostr client, but it's not really feasible (for me) to implement secp256k1 in elisp.
MitchellMarquez42 · 2022-12-27 03:07
It looks like the common lisp package is just wrapping a C program using FFI, which elisp doesn't really do. You could: 1. Just use the C program through shell-commands. This is what many emacs packages do. 2. Use comint or SLIME to work between the elisp and common lisp. This is not very common but can get you better control if you need the internals of the CommonLisp library.
your_sweetpea · 2022-12-27 09:23
I mean, you can absolutely wrap a C library using an emacs dynamic module, although I'll admit learning how to write and distribute well-behaved dynamic modules really is unnecessarily difficult.
wasamasa · 2022-12-27 13:53
3: Write a command-line program exposing a more sophisticated interface than being invoked over and over again. For example it's common to launch a server listening via stdin/stdout or a TCP/UDP/UNIX socket. This is what a lot of IDE-style packages do.