Alright I apologize if this has been asked, but I cannot seem to find this problem through searching. I am trying to figure out how to work on code in Emacs and when I come back open it again to edit the code. I was working with Emacs in the REPL learning Common Lisp and I used the "save as" feature and saved my work. I come to it this morning and try to open it to finish up on it and when I load the file it opens either as read only or it "kills" the REPL and doesn't let me use the functions that I coded originally. When the file is loaded I can't compile it to use in the REPL and it seems to not want to work in the REPL when I try to copy.. I am new to Emacs and I am needing some help figuring out what I did wrong so I don't do this again. Til now I have only coded a few lines and just been starting from scratch and copying what is loaded in the file and completing my exercises, but that limits productivity. I am spending more time trying to figure out how to use Emacs than I am learning Common Lisp. I am not sure what I did wrong, but if there are any Emacs gurus out there that could help me out I would greatly appreciate it! Thank you in advance!
There are two other methods of interacting with Common Lisp, besides SLIME. Although they both use SLIME as a back end.
To make org-babel understand CL, you need to add this to your config (after you've configured SLIME):
(require 'ob-lisp) (org-babel-do-load-languages 'org-babel-load-languages '((lisp . t)))
Here's an example Org content:
* CL is a LISP-2 So you need to quote the ='+= function. #+begin_src lisp (mapcar '+ '(1 2 3) '(1 2 3)) #+end_src #+RESULTS: | 2 | 4 | 6 |
When you navigate to a source block, you can edit it with C-c ' in its native
You can evaluate it with C-c C-c, once SLIME was started.
You can install lispy from the
package manager. Then open e.g.
test.lisp file, navigate to an open
or close paren and press e. If SLIME isn't running yet, it
will automatically start and evaluate the current expression. The
result will be shown in the Echo Area.
If you'd like to see the result in the buffer, press E instead of e. You can also insert the result as a comment by pressing 2e.
You can think of pressing e as:
- copying the expression from source buffer to the kill ring
- switching to the SLIME REPL
- inserting the expression
- switching back to the source buffer
I figured out what I wasn't doing. So to save my source code I have to create a file via C-x C-f and then input the source code into that buffer. Then when I come back to emacs I can open the file and edit the code. At least this worked for me. Thanks for the input.