From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Edit a cl-struct by copy, or, slot-value for cl-structs Date: Sun, 31 Oct 2021 14:52:28 -0400 Message-ID: References: <06C2AE7C-C3E9-4E34-9394-B431173639E9@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33957"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Yuan Fu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 31 19:53:50 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 1mhFxl-0008bF-Sj for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 31 Oct 2021 19:53:50 +0100 Original-Received: from localhost ([::1]:43008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhFxk-0007BF-PH for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 31 Oct 2021 14:53:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhFwc-0007B7-RT for help-gnu-emacs@gnu.org; Sun, 31 Oct 2021 14:52:39 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhFwY-0001Rx-Se for help-gnu-emacs@gnu.org; Sun, 31 Oct 2021 14:52:36 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CA1A2100312; Sun, 31 Oct 2021 14:52:32 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4E38B1001C8; Sun, 31 Oct 2021 14:52:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1635706351; bh=LEk0YZ0dYJIb4+H6d3mTrYN7SUTB+/ND5SsJmPLrIbA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=SH7vn2TE2tm04uC4aguFVyFy2bORY8KEH1ELGoH5blciIqT96MqZBGskjq68gGKPY VZCm/D/PAd30bSZrVgQToiFI/TP2QcwlaZ+e1KMYvfYGZ9ffMaP3sagyJDIKwLeP4t IoWvXjVmH7BzSAbzPDVKUN//UpqX2JRrSpE8nX+83GYZ8dtyTe9yHYj0ydRddjbgcL Fp6jouCSawsB7qtK3ZHHo1YNJdAGCWR5A9WuP2MXvFu4NqhHT2EkRyrDRRFgmtc8Y4 IzuT2RBYSl/y/SeCHCHTvvYMDQnISiA9iUlpToVJQOvBjW9BtmMKGy8gDfOXdEkTiy GMtKWzSWrgeVg== Original-Received: from pastel (unknown [45.72.241.23]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 08C54120458; Sun, 31 Oct 2021 14:52:30 -0400 (EDT) In-Reply-To: (Yuan Fu's message of "Fri, 29 Oct 2021 14:46:45 -0700") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=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:134278 Archived-At: >>> (mapcar #'cl--slot-descriptor-name >>> (cl--struct-class-slots (get (type-of obj) 'cl--class))) >>>=20 >>> But I can=E2=80=99t get any further as I can=E2=80=99t find any generic= getter and >>> setter for cl-struct=E2=80=99s. Something like slot-value. So close! FWIW, I just pushed to `master` a patch which makes `slot-value` work to read slots from structs. It doesn't help you, tho, because it still doesn't let you set them, and in your case it really shouldn't since they are defined as read-only. >> and then use (my-foo-with foo :c 42) and (my-foo-with-a foo 153 "42=E2= =80=9D) > That=E2=80=99s cool. But my lazy fingers like better to write a single fu= nction and > use it for everything ;-) But that tends to come at a performance cost. Stefan