Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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].

Filter by
Sorted by
Tagged with
18 votes
1 answer
4k views

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 ...
147pm's user avatar
  • 2,969
15 votes
1 answer
744 views

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 ...
wvxvw's user avatar
  • 11.4k
10 votes
2 answers
1k views

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 ...
fommil's user avatar
  • 1,800
9 votes
2 answers
3k views

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 ...
Eleno's user avatar
  • 1,448
8 votes
2 answers
3k views

`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/...
NVaughan's user avatar
  • 1,481
7 votes
3 answers
3k views

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 ...
147pm's user avatar
  • 2,969
7 votes
3 answers
1k views

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 ...
Manoel Vilela's user avatar
6 votes
2 answers
466 views

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 ...
Tianxiang Xiong's user avatar
6 votes
2 answers
2k views

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 ...
Gustav Bertram's user avatar
6 votes
1 answer
844 views

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 ...
Joe Corneli's user avatar
  • 1,808
5 votes
2 answers
251 views

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 ...
Dan's user avatar
  • 33.1k
4 votes
3 answers
241 views

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) ...
Damien Cassou's user avatar
4 votes
1 answer
394 views

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 ...
Faheem Mitha's user avatar
4 votes
0 answers
335 views

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: (...
EuAndreh's user avatar
  • 141
3 votes
3 answers
1k views

Good elisp tutorial for thorough Lisp understanding? [closed]

I've been in this catch-22 for a while now: I don't have time to learn Common Lisp first, then elisp, but I don't want to learn elisp without understanding the basic capabilities of Lisp. People have ...
147pm's user avatar
  • 2,969
3 votes
1 answer
1k views

How to use cl-labels?

I am trying to use cl-labels, but i have run into errors i do not understand. Here is elisp code i am using: (defun nthelt (N ARRAY) "Behaves like nth but for arrays" (if (and (>= N 0) ...
Srv19's user avatar
  • 489
3 votes
1 answer
511 views

Adjusting indenting for lisp if statements

I am learning common lisp and am trying to follow the style guide suggested by lisp-lang.org. In this style guide is an if statement style that I think makes the code more readable: (if (cond) (...
CL40's user avatar
  • 133
3 votes
2 answers
1k views

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 ...
stardiviner's user avatar
  • 1,938
2 votes
4 answers
214 views

Reading Common Lisp Source Code Inside Emacs?

I think emacs is just brilliant. The help functionality with C-h is extremely useful. Recently, I started coding in SB Common Lisp. It would be very useful if I could search the definitions of ...
Vinn's user avatar
  • 293
2 votes
1 answer
1k views

Zip/Map functions ending when shortest list runs out

I wanted a function in the style of zip, but rather than stopping when one of the supplied lists runs out, I wanted it to continue using zip on the rest of the lists. Looking around at a few Emacs ...
user avatar
2 votes
1 answer
42 views

getting macro calls to indent correctly (like defun instead of functions) in common lisp code?

I'm editing a Common lisp (not elisp) source file; bottom right says (Lisp adoc [COMMON-LISP-USER sbcl]). I'm using slime, so I'm pretty sure that's what the adoc means. I have the following in a ...
xdavidliu's user avatar
  • 223
2 votes
1 answer
211 views

Why does this function stub not work using cl-letf?

I have written this simple function and I want to stub out the last functions so I don't actually launch a process. (defun dc-test-stub-process (command &rest params) (interactive) (let ((...
Oly's user avatar
  • 593
1 vote
1 answer
554 views

How to set up Emacs with Clozure CL but without SLIME

I want to manually set up my own Emacs CL environment on Mac OS X 7 without the SLIME package i.e. it will only use Clozure CL. To put it other way, I want to use the Emacs CL just like I use the "...
Terry's user avatar
  • 370
1 vote
1 answer
237 views

Does elisp have a way to jump to (goto) labels in the code, ala common lisp's go?

Does elisp have a way to jump to (goto) labels in the code, ala common lisp's go? (tagbody (setq val 2) (go lp) (incf val 3) lp (incf val 4)) => NIL val => 6 PS: This is a ...
HappyFace's user avatar
  • 830
1 vote
1 answer
424 views

Error while trying to set a slot of a cl-struct

Using Emacs 25.1.50.1 To set the slot of a structure, I believe the elisp manual says to use setq along with the accessor function for the slot. Though I am having trouble. The following code ...
lookyhooky's user avatar
1 vote
1 answer
229 views

What's the purpose of `cl-lib` in emacs?

Why does emacs need the cl-lib Common Lisp compatibility? What is it used for?
Kolt Penny's user avatar
1 vote
2 answers
286 views

How to install common lisp with emacs and SLIME when the slime-helper.el is not automatically generated?

I want to get started with Common Lisp and I follow this guide to install it on my arch linux machine. However, this call fails: (load (expand-file-name "~/.quicklisp/slime-helper.el")) ......
user avatar
1 vote
1 answer
333 views

Syntax Highlighting of Common Lisp User-Defined Macros in Emacs

I would like to start writing a few simple Domain Specific Languages in Common Lisp and would like the names of macros I define to be highlighted as if they were Common Lisp functions or macros in ...
Rama Lakshmanan's user avatar
1 vote
1 answer
662 views

Company-yasnippet doesn't see yasnippet template in lisp

Config: (use-package yasnippet :ensure t :hook (prog-mode . yas-minor-mode) ) (use-package yasnippet-snippets :ensure t :after yas) (use-package common-lisp-snippets :ensure t :after ...
C-Entropy's user avatar
  • 143
1 vote
1 answer
679 views

Highlight labels/flet/macrolet definitions in lisp-mode

I found this solution (https://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00322.html, fully cited below), but it isn't working as expected. It highlights only the first definition inside labels/...
Danylo Fedorov's user avatar
1 vote
1 answer
86 views

both keywordp and macrop then eval from a functionp

'Hope it won't bother my using defmacros named in the style of keywords (colon-prefixed, e.g., :set-this or :get-that): it apparently tricks ELisp from otherwise requiring quoted symbols (') or ...
sjb's user avatar
  • 101
1 vote
0 answers
118 views

What's the value in using a REPL for ELISP development? [closed]

What's the value in using a REPL? I've always wondered the advantages/disadvantages of using a REPL are (if there are any) as opposed to eval-print-last-sexp and then undoing the text printed (or ...
John DeBord's user avatar
1 vote
0 answers
24 views

Is there a locate-library equivalent for Common Lisp files?

When editing Common Lisp code, is there an Emacs command that behaves like locate-library that would take a name and attempt to find the location for a Common Lisp file with that name? Looking at ...
PRouleau's user avatar
  • 796
1 vote
0 answers
147 views

Looking for something like cl-applicable-method-p

I am looking for something that could be used like this: (when (cl-applicable-method-p 'foo "arg") ...) I vaguely remember that I have seen that once and that it came with a comment saying that one ...
tarsius's user avatar
  • 25.8k
1 vote
1 answer
108 views

Unexpected indentation in backquoted list starting with comma function call

When I write a backquotedlist that starts with ,( emacs aligns the remaining items to the parenthesis and not to the comma; e.g.: (defun kb-test1 () `(,(hello) fdefef ,(fefesd))) (...
Kasper van den Berg's user avatar
0 votes
1 answer
78 views

How can I configure Slime to use case sensitive symbols?

In emacs lisp variables are not case sensitive, so if I define a variable x, I can access it using X, but I can modify the elisp behavior by (setq readtable-case :preserve), is there something similar ...
Atreyagaurav's user avatar
0 votes
1 answer
70 views

How do I change the default indentation of 'if' for Common Lisp and Scheme?

When I am using (setq lisp-indent-function 'common-lisp-indent-function), the ifs are indented like this: (if x y z) For Scheme, (setq lisp-indent-function 'scheme-indent-function) also ...
Flux's user avatar
  • 603
0 votes
1 answer
261 views

Slime inspector customization (Common Lisp development)

Here follows Common Lisp code, using a datastore library named bknr.datastore (ql:quickload :bknr.datastore) (defclass userdata (bknr.datastore:store-object) ((email :initarg :email :index-...
engineerX's user avatar
  • 123
0 votes
0 answers
100 views

Display function signature in completion popup menu instead of status line with SLIME/SLY in Emacs

What the title says. I'd like the function signature for functions in Common Lisp to display next to the function name in the company-mode autocomplete popup menu instead of at the bottom of the ...
Alexis Purslane's user avatar
0 votes
0 answers
274 views

Slime fuzzy completion not working correctly in TTY mode

I have Slime configured with fuzzy completion and it works perfectly when I'm using it in X11 mode (M-TAB, list of completions pops up in a separate buffer, C-n/p allows to choose the right completion,...
Wojciech Gac's user avatar
0 votes
1 answer
164 views

Direx not working, cl-call-next-method only inside primary and around methods

Setup: GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-07-25 on KAEL Compiled from EmacsW64. Direx, using the latest version of Direx from MELPA Windows 7 x64 bit. Situation: I ...
ReneFroger's user avatar
  • 3,880
0 votes
0 answers
430 views

SBCL and Slime do strange things when I try to use Serapeum

I'm getting very strange behaviour when I try to C-c C-k the following code into the SLIME REPL running SBCL: (eval-when (:compile-toplevel :load-toplevel :execute) (ql:quickload "serapeum")) (...
Koz Ross's user avatar
  • 425