Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use emacs to program in common lisp?

During my course on lisp programming I used the lispworks IDE trial version, which is a very good IDE but it's still a trial version. I searched for a new IDE. And I saw this video https://www.youtube.com/watch?v=VnWVu8VVDbI.

In which he uses slime sbcl and quicklisp to program in common lisp on emacs.

My question is how is that possible?Doesn't emacs come with it's own dialect of lisp which is known as Emacs lisp or are they separate from each other?

like image 772
jakHunter Avatar asked Jul 11 '18 04:07

jakHunter


2 Answers

Setting up Emacs and SBCL can cost you some time.

Update:

Now, I would not answer "portacle" or "lispbox" but Roswell as I explain here!

Previous answer:

I highly recommend you portacle - so to say the newer/younger brother of lispbox. Lispbox is created for 'out of the box'-to go lisp environment using emacs with installed slime-mode readily connected with sbcl and quicklisp-installed (for readers of 'Practical Common Lisp' by Peter Seibel) - kind of emacs-set-up-for-Lisp (or batteries-included-emacs from the perspective of a Lisp-beginner-programmer). I was long searching for this "update" of Lispbox - though meanwhile installed sbcl and quicklisp and slime manually - Actually I think the Lispbox site should link and hint to portacle because this is the up-to-date version of Lispbox - it would have saved me time. The Lisp community should spread the words about portacle. (both provide you with ready-to-go emacs which then is connected to sbcl and also has quicklisp installed - quicklisp for Lisp is like pip for Python, a package manager by which you can pull and install Lisp packages from a central repository - or like melpa for emacs lisp). (quicklisp is in its core asdf, an old package manager, but nobody nowadays uses asdf to install packages directly, but does it via quicklisp).

For Windows users, I highly recommend lispstick which works (in contrast to the current version of portacle for Windows ... I hope they fix it). The author also wrote a nice book (2016, but in German).

For an easier entry to emacs which is very complex and I had also several attempts to get to used to it, I highly recommend you Derek Banas' video tutorial on emacs which is one of the best intro-level tutorial I found for this topic. Also his tutorial for common lisp might give you a good start. I summarized some of the key bindings (a minimal set of key bindings) which I use frequently when programming common lisp in emacs. It is really minimal. Whoever discovers more, can also give me more tipps. Here is the link to a very minimal emacs/SLIME cheat sheet for lisp beginner programmers

The Common Lisp HyperSpec is helpful if you really begin to program in Lisp - it is a necessary tool, I would say - and also the Cookbook page for Lisp initiated by Edi Weitz and also his book with recipes for Common Lisp. However, since Lisp is very different from all the C-derived languages, I highly recommend you to begin with sth which explains you more what lisp is and how it works. A combination of Practical Common Lisp by Peter Seibel and Land of Lisp by Conrad Barski was the starter for me. But although the authors did really a great job, I think a easy-to-read and smooth intro for C-derived language programmer into Lisp is still to be written.

By the way, if you find vim easier to use, there is a nice way to use vim short-cuts in emacs - the evil mode - and even better and fantastic is Spacemacs which has in addition to vim shortcuts - their very specific way to access functions - mostly beginning with pressing the space-button (thus the name spacemacs). It is an open source project.

Unfortunately there is no Portacle-like batteries-included spacemacs for lisp novices. But maybe that is to be set up in near future by some of us :) . Spacemacs is fantastic!

For emacs: I wrote down emacs minimalistics commands for beginners in my GitHubGist.

like image 69
Gwang-Jin Kim Avatar answered Oct 05 '22 21:10

Gwang-Jin Kim


Even though there are already a few good answers to the question, I'd like to add here an answer myself, mostly to mention a great alternative to SLIME for Common Lips development in Emacs.

SLY is a fork of SLIME and contains the following improvements upon it:

  • Completely redesigned REPL based on Emacs's own full-featured comint.el
  • Live code annotations via a new sly-stickers contrib
  • Consistent interactive button interface. Everything can be copied to the REPL.
  • Doesn't need an extra package to work with company (a popular (code) completion package)
  • Contribs are are enabled by default, and loaded with ASDF on demand
  • Support for NAMED-READTABLES, macrostep.el and quicklisp

SLY tracks SLIME's bugfixes and all its familar features (debugger, inspector, xref, etc...) are still available , but with better integration.

Seems to me SLY is the best way to get started with Common Lisp under Emacs these days, so I encourage people to check it out.

like image 28
Bozhidar Batsov Avatar answered Oct 05 '22 23:10

Bozhidar Batsov