Questions tagged [common-lisp]

Editing Common Lisp code and working with inferior Common Lisp read-eval-print loops. Note that Emacs's Lisp dialect is not Common Lisp; for Emacs Lisp, use the tag [elisp].

Common Lisp is a dialect of Lisp that was standardized by ANSI. Note that Emacs's extension language, Emacs Lisp, is not a dialect of Common Lisp; for questions about the Emacs Lisp dialect, use the tag . Emacs has limited support for some Common Lisp features in the cl-lib library since Emacs 24.3, and in the cl library in earlier versions.

ANSI Common Lisp, the programmable programming language.

We have a Wikipedia page on Common Lisp, an online version of the ANSI Common Lisp standard and a list of recommended Common Lisp implementations. Many Lisp specific mailing lists are archived at Gmane.

Popular Common Lisp implementations

See also

40 questions
18
votes
1 answer

require 'cl or require 'cl-lib

In order to include Common Lisp compatibility I've seen both (require 'cl) and (require 'cl-lib) Which is correct? As I understand the cl-lib is the later of the two, but is it safe to use just it?
147pm
  • 2,907
  • 1
  • 18
  • 39
15
votes
1 answer

How to use SLIME as a proxy between Common Lisp program and Emacs Lisp?

I'm looking into doing the following: I have a program written in Common Lisp, which I want to be able to communicate with Emacs. The program deals with natural language parsing, so the things I'd need to access in Emacs would be the contents of the…
wvxvw
  • 11,222
  • 2
  • 30
  • 55
10
votes
2 answers

cl-destructuring-bind on partial plist?

This causes an error (cl-destructuring-bind (&key a b) '(:a "foo" :b 13 :c "bar") (list a b)) because the :c key/value is not handled in the pattern match. Often I find myself wanting to extract some subset of keys/values from a…
fommil
  • 1,750
  • 11
  • 24
9
votes
2 answers

Modifying the indentation of some Emacs Lisp forms

I would like some Emacs Lisp forms to be indented like Common Lisp. For instance, in Emacs Lisp, if is indented like this: (if COND THEN ELSE) whilst I would prefer it like this: (if COND THEN ELSE) I could do this: (setq…
Eleno
  • 1,428
  • 11
  • 17
8
votes
2 answers

`case` doesn't switch correctly with strings

I have the following code which doesn't work: (eval-when-compile (require 'cl)) (setq mymachine (system-name)) (case mymachine ("HP" (setq package-user-dir (concat user-emacs-directory "packages/hp"))) ("DELL" (setq package-user-dir (concat…
NVaughan
  • 1,481
  • 12
  • 27
7
votes
3 answers

Is there an equivalent for defparameter on emacs-lisp?

I know we have defvar and setq. defvar has a special meaning on defining global variables because the assignment only happens once. So I was thinking about use setq to get the desired behavior of defparameter from Common Lisp. However when I use…
Manoel Vilela
  • 675
  • 3
  • 20
7
votes
3 answers

Is using cl-lib crucial for writing good Emacs Lisp code?

As a beginner I understand that including cl-lib will allow me to use some code from Common Lisp. However, whenever I see this included in elisp code I wonder again, Should I really start with Common Lisp, then learn elisp? Is cl-lib giving elisp…
147pm
  • 2,907
  • 1
  • 18
  • 39
6
votes
2 answers

Why does Emacs indent my Lisp LOOP construct weirdly?

I'm using Emacs and SLIME to edit Lisp code. By default, Emacs indents my Lisp LOOP constructs like this: (loop for x across dna1 for y across dna2 count (not (eql x y))) But I expect it to line up subsequent lines with the first…
Gustav Bertram
  • 165
  • 1
  • 8
6
votes
2 answers

Why doesn't "complement" work as a function?

I'm trying to implement the complement function from Common Lisp (CL) in Emacs Lisp, but I'm confused by why defining it as a function (as opposed to a macro) does not work. The macro definition is straightforward: (defmacro complement (function) …
Tianxiang Xiong
  • 3,848
  • 16
  • 27
6
votes
1 answer

writing emacs extensions in common lisp or other languages

Some years ago, I was working on a personal project that seemed to work best with Emacs as the user interface, and Common Lisp (SBCL) as the back-end. The accepted answer on How to use SLIME as a proxy between Common Lisp program and Emacs Lisp?…
Joe Corneli
  • 1,786
  • 1
  • 14
  • 27
5
votes
2 answers

How can I define new places for setf?

Q: how do I teach setf about new places it can set? In common lisp, one uses the macro defsetf to tell setf about new places it can set. In elisp, that macro exists in in the cl library, but, as far as I can tell, has not been ported into the…
Dan
  • 32,584
  • 6
  • 98
  • 168
4
votes
1 answer

Creating permanent fixed buffer for CLHS lookup

Suppose I open one window with a Common Lisp file in it, and a second window with SLIME REPL in it (using M-x slime or whatever). Now, doing C-c C-d h with point on a Common Lisp keyword brings up a window with the CLHS entry for that keyword (using…
Faheem Mitha
  • 406
  • 4
  • 16
4
votes
3 answers

idiomatic way to lexically scope variables in a cl-loop body

Here is some asynchronous code in a cl-loop: ;;; foo.el --- -*- lexical-binding: t; -*- (let ((my-list '(a b c))) (cl-loop for index below (length my-list) for value = (seq-elt my-list index) do…
Damien Cassou
  • 877
  • 4
  • 14
4
votes
0 answers

Slime creates new window every time you interact with the debugger

While using slime+emacs, I'm having a problem when interacting with the debugger: every time that I choose one of the debugger's option, a new window pops up in Emacs. For example, when evaluating: (step (progn (print 1) (print 2) …
EuAndreh
  • 141
  • 2
3
votes
2 answers

How to change Org-mode Babel lisp source code block from SLIME to SLY?

I found ob-lisp.el use SLIME by default to evaluate lisp code. I want to use SLY to evaluate lisp code. How to change it? I found the file ob-lisp.el is short. I tried to change slime to sly. But it is not customizable. I hope to define a defcustom…
stardiviner
  • 1,888
  • 26
  • 45
1
2 3