Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cl-lib]

The tag has no usage guidance.

2
votes
1answer
29 views

with-slots with defstruct “class” instance

Is it possible to use a with-slots-type macro with an instance of a defstruct-defined class in emacs lisp? I tried and I'm getting this error: eieio-oset: Wrong type argument: eieio-object, "some-...
5
votes
1answer
70 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 ...
0
votes
1answer
27 views

Search for occurrence of character within a string without using the common lisp library?

I need to extract certain information from buffer names, and I'm doing so by extracting substrings based on the position of unique characters within a buffer name string. So, I currently am doing ...
1
vote
1answer
36 views

Is it necessary for me to use `cl-labels` in this grouping function, when plain recursion does the job as well?

So I'm reading through some tutorials with Common Lisp, and I came across this function, group: (defun group (source n) (if (zerop n) (error "zero length")) (labels ((rec (source acc) ...
4
votes
0answers
67 views

indent cl-loop to respect `if else` statements

I have a hard time writing and reading cl-loops with they way they're indented by default as I can't easily tell what the control flow is: (cl-loop for x below 10 if (cl-oddp x) ...
1
vote
3answers
129 views

Indenting `cl-flet` etc

Is there a way to indent cl-flet, cl-labels etc. using the CL style without resorting to (setq lisp-indent-function #'common-lisp-indent-function)? cl-indent.el claims that: common-lisp-indent-...
1
vote
0answers
27 views

Suppress creation of slot accessors for cl-defstruct :include slots?

Is it possible to suppress creation of slot accessors for slots included via :include? For example, in the following: (cl-defstruct person name (age 0) sex) (cl-defstruct (astronaut (:include person ...
1
vote
1answer
52 views

Equivalent of EIEIO's make-instance for cl-lib structs?

What equivalents exist for EIEIO's make-instance in cl-lib? (make-instance 'my/class :slot-a "value" :slot-b "value") I would like to create an instance of an arbitrary struct identified by a ...
1
vote
2answers
46 views

cl-lib isn't loaded the first time an autoloaded function is used from it

I'm trying to use cl-lib early in my init.el. The function I'm using (cl-some) is autoloaded, so I expect that don't need an explicit require, yet I get a void-function error if I don't explicitly ...
0
votes
1answer
39 views

How can I use edebug with cl-block?

Given the following function using cl-block: (defun wh/with-block (x) (cl-block 'foo (+ x 1))) I can evaluate it, but C-u M-x edebug-eval-defun gives an error: edebug-syntax-error: Invalid ...
1
vote
1answer
196 views

Using local variables in cl-loop

This is my first time trying to write my own elisp code, so bear with me. I have the following cl-loop: data contains the following: ((refs . [((file . "api/user.js") (start . 266) (end . 269)) ((...
3
votes
1answer
243 views

Defining a generic function and implementing specialised methods

Emacs provides support for polymorphism, supporting "generic functions", like in CLOS. According to Emacs manual: A generic function specifies an abstract operation, by defining its name and list ...
3
votes
3answers
146 views

Where is cl-constantly and what to use instead?

In Common Lisp, there is constantly function, which creates new function without side-effects that takes any number of arguments and always returns specified value. For some reason cl-lib doesn't ...
4
votes
2answers
510 views

Alternative to lexical-let

I'd rather not use cl-lib and cl at the same time. However, I really like using lexical-let to specify the usage of lexical binding on a more granular level. Is there any equivalent in cl-lib or ...
1
vote
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 ...
17
votes
2answers
657 views

What's the correct replacement for flet on new emacsen?

I have some code that uses flet to temporarily change the behaviour of functions. ;; prevent changing the window (flet ((pop-to-buffer (buffer &rest args) (switch-to-buffer ...
7
votes
2answers
2k views

“Symbol's function definition is void: cl-macroexpand-all” when trying to install php-mode

I'm trying to install php-mode, but I keep encountering this error when I run M-x php-mode: Symbol's function definition is void: cl-macroexpand-all The error persists whether I install php-mode via ...