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
4
votes
3answers
84 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) ...
1
vote
0answers
45 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 ...
8
votes
1answer
499 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 ...
39
votes
9answers
5k views

How can I start learning Emacs Lisp?

Background: I'm mostly a vi user and am converting to Emacs. Past the basics and now use it for writing code in C and some Python with plans to do an R conversion too. I wrote (Common) LISP for ...
1
vote
1answer
48 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))) (...
1
vote
1answer
376 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/...
4
votes
2answers
97 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 ...
2
votes
1answer
106 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 ((...
5
votes
3answers
514 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 ...
6
votes
2answers
980 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 ...
0
votes
1answer
154 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-...
6
votes
2answers
2k 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/...
0
votes
1answer
135 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 ...
8
votes
1answer
278 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 ...
2
votes
1answer
363 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) ...
0
votes
0answers
171 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,...
6
votes
2answers
299 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 ...
1
vote
1answer
411 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 ...
0
votes
1answer
107 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 ...
2
votes
3answers
720 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 ...
2
votes
3answers
1k 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 ...
2
votes
1answer
978 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 ...
8
votes
2answers
2k 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 ...
5
votes
1answer
426 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 ...
4
votes
0answers
208 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: (...
1
vote
1answer
72 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 ...
1
vote
1answer
382 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 "...
0
votes
0answers
334 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")) (...
15
votes
1answer
488 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 ...
4
votes
1answer
298 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 ...