UP | HOME

Marcus Santos

Emacs & Lisp enthusiast

Getting your Emacs/Slime-based Lisp programming environment up and running for CPS305
Published on Apr 04, 2023 by Marcus Santos.

“Lisp is the red pill.” — John Fraser Source

Introduction

The Lisp programming environment consists of the following components:

  • text editor (Emacs); you may be tempted to use another text editor but I strongly encourage you to use emacs. However, if you insist on using another editor, I advise you choose it carefully. Stay away from program text editors that do not perform automatic parenthesis matching; it is virtually impossible to write lisp code without it;
  • the Steel Bank Common Lisp (SBCL) compiler;
  • package management (Quicklisp); and
  • CodeGrader, a software application for assessing lisp program correctness.

Emacs and SBCL have been installed on all lab computers. To complete the user-based setup of the programming environment, please adhere to the instructions below for installing the additional components within the user’s home directory.

Emacs Configuration and Quicklisp Installation

  1. First and foremost, you will need to understand how to run simple commands on a Linux or Mac terminal window. Navigate to https://marcus3santos.github.io/linux-terminal-101.html and complete the short tutorial on what the Terminal is and how to run commands on it.
  2. Please navigate to https://github.com/susam/emacs4cl and carefully proceed with steps 2 to 6 (inclusive) outlined in the Get Started section. These steps will guide you through the process of installing the configuration files for Emacs and SBCL, as well as installing Quicklisp.

Installation of CodeGrader

Type the commands below on a shell terminal to install CodeGrader:

cd ~/quicklisp/local-projects
git clone https://github.com/marcus3santos/codegrader.git

Configuring SBCL

  1. Using a program text editor, open the following file located on your home directory

    ~/.sbclrc

    then copy-paste and save the code below at the bottom of the program already in ~/.sbclrc

    (ql:quickload :rutils)
    (ql:quickload :codegrader)
    
  2. Quit Emacs, open it again, then press M-x (i.e., press and release Esc, then press and release x) and type slime and press Enter. Emacs/Slime will then load the new configuration and program utilities.
  3. In the Lisp buffer, type the following command:

    CL-USER> (cg:eval-solutions "" :Lab01)
    

    If you have properly installed and configured Emacs and the program utilities, then Lisp should display the following messages after the command above:

    --EVALUATION FEEDBACK--
    
    NOTE:
    - Each question is worth 100 points.
    - Your score is the sum of your questions' points divided by the number of questions in the assessment.
    END OF NOTE.
    
    Your score: 0 (out of 100)
    ...  
    
  4. That’s it. The Lisp programming environment is now installed and configured.