[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
EIEIO accessing class slots
From: |
pillule |
Subject: |
EIEIO accessing class slots |
Date: |
Thu, 10 Jun 2021 17:20:35 +0200 |
Hi
How can I accede to the initarg of an eieio class ?
Let's say I have a class as :
(defclass moirai-dired-side ()
((display-alist
:initarg :display-alist
:initform '((moirai-dired-p)
(display-buffer--in-dired-side-window)
(slot . 0) (side . left) (select . t)
(preserve-size (t . t)) (window-width . 35)
(window-parameters . ((no-other-window . t)
(no-delete-other-windows . t))))
:custom (custom-variable-type 'display-buffer-alist)
:documentation
"Alist of conditionals actions for `display-buffer',
It is the same format that `display-buffer-alist'.")))
Now I can create instances with
(setf morai-dired-side-left (moirai-dired-side))
And so far manipulating the object will work fine,
but if we go back to the class itself ...
;; apparently this is not an eieio-class ?!
(eieio--class-p 'morai-dired-side)
;; => nil
;; but I can anyway access its slots
(eieio-class-slots 'moirai-dired-side)
;; => (#s(cl-slot-descriptor display-alist '((moirai-dired-p)
(display-buffer--in-dired-side-window) (slot . 0) (side . left) (select . t)
(preserve-size (t . t)) (window-width . 35) (window-parameters (no-other-window
. t) (no-delete-other-windows . t))) t ((:documentation . "Alist of
conditionals actions for `display-buffer',
It is the same format that `display-buffer-alist'.") (:custom
custom-variable-type 'display-buffer-alist) (:group default))))
;; the issue is I have no idea of how to get them individually
(eieio--class-slot-initarg 'moirai-dired-side :display-alist)
;; ! Wrong type argument: eieio--class, moirai-dired-side, class
Am I missing something ? I seen a bug report from 2015 at this subject
(#bug19552) but it doesn't help.
As a side note the eieio manual is outdated, it references 'class-slot-initarg',
while it is now 'eieio--class-slot-initarg'.
--
- EIEIO accessing class slots,
pillule <=