Hello there
I wuold like to pose you a question about the way you use to carry out an incremental programming style with emacs, or in general with the repl... at my very first steps, being used to have a structured-file-to-compile, I asked you how to execute a file from the repl, however after some weeks of little practice, I see that working first with the repl could be quite more enjoyable and productive. So I wuold like to ask you: how do you use to carry out your work? Do you start coding into a file and then loading and testing it from the repl? Or do you code in the repl and then copy and paste it into a file? Or maybe do you have tools that automate these actions for you? That final case wuold be the one of most interest... by the way, what is the strategy you wuold want to suggest?
Incremental programming style
Re: Incremental programming style
The following is not intended to be an "Emacs with SLIME" commercial, but "If you are looking for a good Common Lisp IDE you have the choice between Emacs with SLIME, Emacs with SLIME, and Emacs with SLIME." I would like to give credits to the original author of this citation, but stupidly I have forgotten where I have read it.
When I started with Lisp I used JEdit (a Java-based text editor that I already knew at that time) to write my Lisp code, then I saved the file to disk, and LOADed the file from the Lisp REPL, running in a shell window. Although possible, it was rather tedious to work this way because I had to switch back and forth between the editor and the REPL rather often.
Today, using Emacs with SLIME, there is not much difference between working from a file or in the REPL because the REPL functionality is available in all Common Lisp file buffers (the Emacs window containing the text of the file), where the main differences and advantages of using Emacs and SLIME over JEdit and the REPL are:
Again I'm not such a nerd who thinks that Emacs is the "best text editor ever", but Emacs Lisp is similar to Common Lisp, and I often start prototyping simple things in Emacs Lisp and later switch to Common Lisp (mainly because Emacs Lisp has rather poor math support). Such things are not possible with Vim and slimv. That's not because I think that Emacs is "better" than Vim in all aspects, but Lisp development is easier with Emacs.
Here are some videos for people who want to see Emacs and SLIME in action:
- edgar
When I started with Lisp I used JEdit (a Java-based text editor that I already knew at that time) to write my Lisp code, then I saved the file to disk, and LOADed the file from the Lisp REPL, running in a shell window. Although possible, it was rather tedious to work this way because I had to switch back and forth between the editor and the REPL rather often.
Today, using Emacs with SLIME, there is not much difference between working from a file or in the REPL because the REPL functionality is available in all Common Lisp file buffers (the Emacs window containing the text of the file), where the main differences and advantages of using Emacs and SLIME over JEdit and the REPL are:
- In an Emacs buffer containing Common Lisp code I can evaluate every single Common Lisp expression without LOADing the file, as if I were in the Common Lisp REPL. This way I can write and test code incrementally and interactively directly from the file buffer without switching to the REPL every time.
- If an error happens, an additional debugger window appears automatically, showing the backtrace (how the error happened) and all available restarts (how to continue).
- If my code has produced errors, SLIME underlines the part of the Lisp code that has caused the error, and if I move the mouse pointer over the underlined code, a small tooltip window appears showing the related error message. This way it's dead-easy to see which code has produced what error.
- SLIME has an integrated debugger and inspector (to investigate all sort of Lisp data at run-time), and a CLOS class browser.
Again I'm not such a nerd who thinks that Emacs is the "best text editor ever", but Emacs Lisp is similar to Common Lisp, and I often start prototyping simple things in Emacs Lisp and later switch to Common Lisp (mainly because Emacs Lisp has rather poor math support). Such things are not possible with Vim and slimv. That's not because I think that Emacs is "better" than Vim in all aspects, but Lisp development is easier with Emacs.
Here are some videos for people who want to see Emacs and SLIME in action:
- Tom Briggs: Edit LISP code with Emacs & SLIME - short video
- Marco Baringer's SLIME Tutorial Video - long video
- SLIME homepage: Superior Lisp Interaction Mode for Emacs
- CLiki: SLIME Features - an evolving description of the features available in SLIME
- edgar
-
- Posts: 21
- Joined: Wed Jul 29, 2015 7:25 am
Re: Incremental programming style
Perfect perfect! :) You don't need to convince me as I've already started to use Emacs when I understood what it was... just... I've postponed the time in wich I'll really learn how to use it. Until now I've simply gone having two buffers, one with the repl and the other with a lisp file, so I was searching a way to make the two cooperate. I didn't realize to have all what I need in the SLIME menu :D quite embarassing... but the Tom Briggs video resolved my troubles.
As ever, many thanks! ;)
As ever, many thanks! ;)