emacslispcommon-lispsbclslime

Trouble Running Lisp Script in Emacs with SBCL


I'm encountering an issue when trying to run a Lisp script in Emacs with SBCL. I have the following directory structure:

- SBCL: /home/user/.roswell/impls/x86-64/linux/sbcl-bin/2.3.8/bin/sbcl
- Lisp Script : /home/user/src/q1.lisp
- Emacs: - /var/lib/dpkg/alternatives/emacs
         - /var/lib/emacsen-common/state/flavor/installed/emacs

I load the script in Emacs using Alt-X load-file and then provide the full path to the hello.lisp file.

Here's the content of my hello.lisp file:

(defun hello-lisp ()
  (format t "Hello, Lisp!~%"))

(hello-lisp)

However, when I attempt to run it, I receive the error message "Wrong type argument: stringp, t." I'm not sure why I'm getting this error, and I'm looking for guidance on how to properly execute Lisp scripts in my environment.


Solution

  • As far as I can tell, you're not using SBCL or Slime at all here. You're using Emacs command load-file, and loading a file that's interpreted as Emacs Lisp, not Common Lisp. That's what load-file does.

    The error is that Elisp function format is different from Common Lisp function format. The Elisp function expects a format string, not the symbol t, as its first argument. Use C-h f format to see its description.