Questions tagged [eieio]
15 questions
5
votes
1 answer
Can a symbol have a function, variable, and class?
Q: can one symbol refer to a function, a variable, and a class?
Elisp is a Lisp-2 in which a symbol can have separate
function and variable values. So, for example, I can define the
following function and variable:
(defun kittens ()
"Profess love…

Dan
- 32,584
- 6
- 98
- 168
3
votes
1 answer
Breaking changes to eieio in Emacs 27?
Q: are there breaking changes to eieio in Emacs 27?
I just upgraded to the Emacs 27 snapshot, and I'm getting a
peculiar break in code that works in previous versions of Emacs.
walkthrough
Here's a toy class and a toy :after method:
(defclass…

Dan
- 32,584
- 6
- 98
- 168
3
votes
1 answer
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-string", obj.
Sample code:
(progn
(defstruct…

erjoalgo
- 853
- 1
- 5
- 18
3
votes
1 answer
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 supplied symbol without reliance on knowledge of the…

ebpa
- 7,319
- 26
- 53
3
votes
1 answer
How do you use the eieio-persistent class to serialize a set of objects?
I am trying to use the eieio-persistent class to make persistent objects. My goal is to store many objects in a file.
I am not sure how to achieve this though. If I use this code, I do get a persistent object saved in test.db, but (perhaps…

John Kitchin
- 11,555
- 1
- 19
- 41
2
votes
1 answer
Why does EIEIO's type-predicate fail for subclasses?
If I define a class with EIEIO, then define a subclass which inherits from it, I would expect the type predicate for the superclass (automatically defined by EIEIO) to return t for instances of the subclass as well, but it doesn't. A simple…

modallyFragile
- 123
- 2
1
vote
1 answer
hold a list of objects in the slot of another object?
i'm playing around with EIEIO and jeison.el, trying to model a json rest api for an emacs client.
if i define a class, its slots can also specify a :type, and this can be another class i have created. when i instantiate the object, the slot contains…

user27075
- 488
- 3
- 11
1
vote
0 answers
When should one use `make-instance` over calling the EIEIO class constructor function?
When an EIEIO class is defined:
(defclass my-test ()
((slot1 :initform 0)))
A constructor function of the same name is also defined. However, there's also make-instance, which also makes a new instance of the class.
(let ((a (make-instance…

Kisaragi Hiu
- 315
- 1
- 6
1
vote
0 answers
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 shouldn't use it. However I would like to at least…

tarsius
- 25,298
- 4
- 69
- 109
1
vote
1 answer
change EIEO class slot default
I am trying to modify a slot in a class (created with EIEIO library). I can access the slot with (oref-default 'helm-source-ffiles filtered-candidate-transformer) and that returns
(helm-ff-sort-candidates
(lambda
(candidates _source)
(cl-loop…

Prgrm.celeritas
- 849
- 6
- 15
0
votes
0 answers
How do I define a eieio class which is a vector of a set of eieio objects
How do I define a eieio class which is a vector of a set of eieio objects?
Specifically, I want the :type property of defclass to effectively say "a vector/list of some other type", and :initform to take a list/vector of some other object.
Is this…
user39778
0
votes
0 answers
How to debug a bug in cl-generic.el?
While working on developing a fork of inf-ruby such as to use EIEIO and cl-generic in an approach, I've discovered what appears to be a bug in cl-generic.el.
I'm testing this presently with GNU Emacs 29.0.50 on FreeBSD 13.1 amd64. This Emacs build…

Sean Champ
- 60
- 5
0
votes
0 answers
How can I advise a cl-defgeneric method?
There's a bug in eglot.el where initialisation options aren't handled, so I can't set the initialisation parameters for a given server; that is causing me problems because the language server I'm using is running out of memory because I have too…
0
votes
0 answers
Why an error when calling a command in a specific buffer?
Q: why do I get errors when calling a command from a specific buffer, but not in any other buffer?
Scratch all of what I had previously said about
call-interactively (see strikethrough below for reference). It's not even remotely that.
I've done…

Dan
- 32,584
- 6
- 98
- 168
0
votes
1 answer
Adding a method to ‘make-instance’ fails every time I try
So, I’ve learned enough about generic functions, CLOS, and EIEIO to believe that this should work:
(defclass foo () nil)
(cl-defmethod make-instance ((x foo) &rest args)
(with-temp-message "Is this thing on?"
(sit-for 1))
…

Tina Russell
- 380
- 2
- 10