-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Emacs Lisp #784
Conversation
So, aside from the basic Emacs Lisp interaction, using https://github.com/jcaw/porthole, I build a simple rpc server and using the great JSONRPC client https://github.com/cxxxr/jsonrpc. I would add some basic completion, description and goto definition. |
There is also an interesting idea here, there are some packages from GNU Emacs (like org-mode) with a lot of functionality that would be long to implement in Lem. Until a package version comes, we can leverage that heavy lifting to a GNU Emacs instance. Which can be a custom one more suited to interact with Lem (so the user don't have to install GNU Emacs nor configure anything). |
So, I moved away the elisp file and convert it to an Emacs Lisp package (https://github.com/Sasanidas/lemmigton). I'm having some problems with the ELTR integration with the RPC server and I think it's an Emacs limitation on threads, given that ELTR takes the main thread as an input loop. I'll open an issue on the ELTR repository so maybe we can look for a solution. 👍 |
Still, I think this pull request is good enough for the support for Emacs Lisp, I'll open more in the future to add other capabilities 👍 (ping @cxxxr for review) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the very nice PR!
I have a few minor comments 🙏
@@ -0,0 +1,118 @@ | |||
(defpackage :lem-elisp-mode.run-elisp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use a /
to match the delimiter of the package name
The old one has .
in some places, but I will fix it in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I changed it 👍
lem.asd
Outdated
:build-operation program-op | ||
:build-pathname "lem" | ||
:entry-point "lem:main" | ||
:depends-on ("lem-ncurses")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the indentation is off.
I would appreciate it if you could make the indentation the standard space indentation for lem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops! Sorry, sometimes when I don't have sly open the auto-indentation is a little off.
"Returns a list of all the Emacs Lisp symbols defined." | ||
(mapcar (lambda (i) (format nil "~a" i)) | ||
(jsonrpc:call client "lemmington-get-completion" (list prefix) | ||
:basic-auth '("lem" . "lem")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is basic auth required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's because of how https://github.com/jcaw/porthole works, still, I opened a pull request cxxxr/jsonrpc#37 to add it to jsonrpc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I see.
I've merged it.
Thank you so much! |
Bravo! Is it on lem-page's documentation yet? :D |
Oh, not yet, I do want to make a small explanation, right not is not that straight forward to get auto-completion (I'm also waiting for this issue jcaw/porthole#3 , because I don't want the hackish way of having 2 Emacs open) |
Add support for GNU Emacs Lisp programming language, aside from the syntax highlight, I thought a couple of approaches to enable a proper REPL:
I decided to use the last one, because it works, is easy to use and in the end, I'm not that interested in Lem becoming the best Emacs Lisp editor, so having basic REPL interaction is good enough for me.