From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pillule Newsgroups: gmane.emacs.help Subject: Re: EIEIO accessing class slots Date: Fri, 11 Jun 2021 01:04:18 +0200 Message-ID: <87mtrxnvp7.fsf@riseup.net> References: <87eed9pwyi.fsf@riseup.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28874"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 11 01:32:00 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrU9X-0007E9-5c for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 11 Jun 2021 01:31:59 +0200 Original-Received: from localhost ([::1]:35406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrU9V-0003fC-0R for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 10 Jun 2021 19:31:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrU93-0003f4-Up for help-gnu-emacs@gnu.org; Thu, 10 Jun 2021 19:31:29 -0400 Original-Received: from mx1.riseup.net ([198.252.153.129]:37608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrU91-0000nB-JY for help-gnu-emacs@gnu.org; Thu, 10 Jun 2021 19:31:29 -0400 Original-Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4G1KxB3FCLzDqvt; Thu, 10 Jun 2021 16:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1623367886; bh=+pnHzv+VgjFDaUkEQef64Y1yAW7D4+BQIDqBjMYL+QA=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=NRerzAZPPcDFcHh8AW0nfktGfY7YjR8m/zFYcA/Egp96R2yIuvDpIaphgoncC2q2r /4+mfV/efpbU4brmuM9tWAroKEA8OkBXSVo/X1MUhQmieqbKN8SbjtJgWEdsLGB3nz mV1nNuryjljvnnb8VT5HP7H4INhk4oJstXG0ujlI= X-Riseup-User-ID: E46C9735344F1B4C12087832BBBD0E1085591B8E7D6C10C0CED940EBAE961166 Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4G1Kx90C5Bz5vS1; Thu, 10 Jun 2021 16:31:24 -0700 (PDT) In-reply-to: Received-SPF: pass client-ip=198.252.153.129; envelope-from=pillule@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130731 Archived-At: Stefan Monnier via Users list for the GNU Emacs text editor writes: >> How can I accede to the initarg of an eieio class? > > What do you mean exactly by that and why do you need that? > I have a class 'moirai-dired-side' ; I make instances from it that I store as frame parameters, eg, 'moirai-dired-side-left' or 'moirai-dired-side-right'. The following function is a function usable by 'display-buffer'. At the moment of its call, an object of the class may already exist, or not. Depending from which window it is called, I want to adjust the get-or-create of the object. I could use 'left as I know it is the default value, but this is cutting grass under foots for future customizations. This need adjustments but I hope you get the idea. (defun display-buffer-in-dired-side-window (buffer alist) "Display BUFFER in a side window with `dired-side-window-parameters' as ALIST. The side parameter that may be inherited from a selected dired side window. Only apply for buffers using `dired-mode' without `inhibit-same-window'." (when (and (dired-buffer-p buffer) (not (cdr (assq 'inhibit-same-window alist)))) (let* ((side (or (window-parameter (selected-window) 'window-side) (alist-get 'side (oref-default 'moirai-dired-side :display-alist)))) (strand-name (intern (concat (prin1-to-string 'moirai-dired-side) "-" (prin1-to-string side)))) (strand (morai-get-or-create 'moirai-dired-side strand-name))) (let ((window (display-buffer-in-side-window buffer (cdr (oref strand :display-alist))))) (oset strand :buffer buffer) (oset strand :window window) (morai-update-prev-buffers strand window) window)))) >> ;; apparently this is not an eieio-class ?! >> (eieio--class-p 'morai-dired-side) >> ;; => nil > > `eieio--class-p` checks if the arg is a class object, where you passed > a symbol which is the *name* of the class object. Then how to access to the object ? --