all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pillule <pillule@riseup.net>
To: help-gnu-emacs@gnu.org
Subject: EIEIO accessing class slots
Date: Thu, 10 Jun 2021 17:20:35 +0200	[thread overview]
Message-ID: <87eed9pwyi.fsf@riseup.net> (raw)



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

--



             reply	other threads:[~2021-06-10 15:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 15:20 pillule [this message]
2021-06-10 19:38 ` EIEIO accessing class slots pillule
2021-06-10 22:03   ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-10 22:02 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-10 23:04   ` pillule
2021-06-11  0:04     ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-11  0:23       ` pillule
2021-06-11  0:59         ` pillule
2021-06-11 13:50           ` Stefan Monnier
2021-06-11 13:45         ` Stefan Monnier
2021-06-11 14:23           ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-11 14:29             ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-12 10:35           ` pillule
2021-06-11  2:52       ` pillule

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eed9pwyi.fsf@riseup.net \
    --to=pillule@riseup.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.