From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63513: [PATCH] Make persist-defvar work with records and hash tables Date: Mon, 15 May 2023 14:31:40 +0300 Message-ID: <83jzx925lv.fsf@gnu.org> References: <87wn1axgh6.fsf@breatheoutbreathe.in> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20443"; mail-complaints-to="usenet@ciao.gmane.io" Cc: adam@alphapapa.net, 63513@debbugs.gnu.org To: Joseph Turner , Phillip Lord , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 15 13:32:14 2023 Return-path: Envelope-to: geb-bug-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 1pyWR4-00056O-2Y for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 May 2023 13:32:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyWQw-0001Gh-HJ; Mon, 15 May 2023 07:32:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyWQt-0001GX-Jd for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 07:32:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pyWQs-00041G-P5 for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 07:32:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pyWQs-0004H9-KX for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 07:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 May 2023 11:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63513 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63513-submit@debbugs.gnu.org id=B63513.168415030616410 (code B ref 63513); Mon, 15 May 2023 11:32:02 +0000 Original-Received: (at 63513) by debbugs.gnu.org; 15 May 2023 11:31:46 +0000 Original-Received: from localhost ([127.0.0.1]:42901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyWQb-0004Gc-VZ for submit@debbugs.gnu.org; Mon, 15 May 2023 07:31:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyWQZ-0004GM-8M for 63513@debbugs.gnu.org; Mon, 15 May 2023 07:31:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyWQS-0003v8-5p; Mon, 15 May 2023 07:31:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=TZP/mbs4VuVCVqwaB13T7KytZM7Bfvo7pDVjAb+sPqc=; b=epwrfkRoLh+O TnASfmC1H1xZk+VHUYRPmNAhLOn1pT8aDwj/GSJ4GGEbw762XY0mU2IUcvcCfg/qZUDXA4lQFYWp8 NUpmdjeamU0XBlXf48WTp9MNAVS4hPRw9VBfH9Hs3yoW3ya0wasX18SHeWNGOTdQ6dhxD8tmxAFV3 N6dxZRNWrkKxE5JSPDSL+u6bAHI4BY5RkaoCDJrTRcK/lAp1GZejVssISNKh9rSXVjV6nHh9LhHLe TwZ4tbN+MgDEJAb/61nselSfrSIf9qLIwzrAZ1olw548GHj8ZrtCM3e+nObfLghFbwYcG+x/NeKn0 z9Msjstl/w1p+zh9MaUJLA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyWQR-0006E0-LW; Mon, 15 May 2023 07:31:35 -0400 In-Reply-To: <87wn1axgh6.fsf@breatheoutbreathe.in> (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261738 Archived-At: > Cc: Adam Porter > Date: Sun, 14 May 2023 22:56:20 -0700 > From: Joseph Turner via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > persist-defvar does not persist records or hash tables correctly. > > Here's a minimal example with a hash table: > > (progn > (persist-defvar foo (make-hash-table :test #'equal) "docstring") > (puthash 'bar t foo) > (persist-save 'foo) > (gethash 'bar (persist-default 'foo))) ;; Expected nil, got t > > This patch fixes persisting records by using copy-tree. Currently, > copy-tree does not work with records (see > ). > The following snippet will return the expected value only when both this > patch and the above-linked patch are applied: > > (progn > (cl-defstruct baz a) > (persist-defvar quux (make-baz :a nil) "docstring") > (setf (baz-a quux) t) > (persist-save 'quux) > (baz-a (persist-default 'quux))) ;; Expected nil, got t > > Before applying this patch, the updated values in both cases are not > persisted to disk. With the patch, the updated values are persisted as > expected. Philip, any comments?