From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: Any way to control which articles Gnus summary shows by default? Date: Sun, 08 Apr 2018 16:59:13 -0700 Message-ID: <87h8olmer2.fsf@ericabrahamsen.net> References: <86lge3ric2.fsf@zoho.com> <87vad78nh2.fsf@web.de> <87sh8bsa2c.fsf@ericabrahamsen.net> <87in97jkzk.fsf@web.de> <87lge3ryvn.fsf@ericabrahamsen.net> <87sh8bm3u1.fsf@web.de> <874lkogzel.fsf@web.de> <87lge0pdfg.fsf@ericabrahamsen.net> <87efjsdxx0.fsf@ericabrahamsen.net> <87d0z9zss2.fsf@web.de> <87r2npoi40.fsf@ericabrahamsen.net> <878t9xzoot.fsf@web.de> <87woxhmsim.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1523232018 3029 195.159.176.226 (9 Apr 2018 00:00:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 9 Apr 2018 00:00:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 09 02:00:14 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f5KEH-0000hO-Rl for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Apr 2018 02:00:14 +0200 Original-Received: from localhost ([::1]:39740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5KGN-0000eR-Hc for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Apr 2018 20:02:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5KFr-0000dy-3E for help-gnu-emacs@gnu.org; Sun, 08 Apr 2018 20:01:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5KFo-0000DP-1y for help-gnu-emacs@gnu.org; Sun, 08 Apr 2018 20:01:51 -0400 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:57760) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5KFn-0000D9-Qv for help-gnu-emacs@gnu.org; Sun, 08 Apr 2018 20:01:47 -0400 Original-Received: from localhost (71-35-188-108.tukw.qwest.net [71.35.188.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 9B58EBE8BD; Mon, 9 Apr 2018 00:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1523232106; bh=tcTl30OHAEvBLjC04BWkNtO4Om4Z/TNKpzIbQiUG9vA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=FWjkSyz07ZXIzKq1ZpDFCqwsbg7PttV0xQSAnArP3qPVxj9/OKXyeLWIEE3zDQa/a tKrzDkSYm6r/3KlopPDrf49g72MO1iqA+6ozzeH5k8SjZLKTKKfLaQTqwgU0MIzahh BFbVBV/SxmTaoRfrlW180d55UXTm/54wel5UZZ8k= In-Reply-To: <87woxhmsim.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 08 Apr 2018 12:01:53 -0700") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 50.56.99.223 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116416 Archived-At: --=-=-= Content-Type: text/plain Eric Abrahamsen writes: > Michael Heerdegen writes: > >> Eric Abrahamsen writes: >> >>> Yes, the whole problem arose from the fact that the write/restore >>> process isn't recursive. In Emacs 26, the process needed to "look >>> deeper" inside the objects, and I thought that in doing that I'd been >>> careful to balance the write and restore process. Apparently I've still >>> failed to get it right -- though now I'm only seeing quote accumulation >>> in the secondary tables, not the main :data table. >> >> Same here: not in :data, but in :tracker. But the :tracker data >> contains sub-hashtables, while :data doesn't. > > Okay, the immediate problem is that `eieio-override-prin1' is recursive > inside hash tables (it adds quotes to hash table values to an arbitrary > depth), but the mirror-image recovery process inside > `eieio-persistent-validate/fix-slot-value' is not recursive, and only > examines one layer. > >>> The whole process is ad hoc and largely unnecessary. In #29541 I've >>> started working on a more general solution that would be actually >>> recursive, and also not work so hard. I've had second thoughts about the >>> patch I posted there, but I think the general direction is correct. >> >> What would happen if we just don't add quotes when writing lists? > > The solution will either be not adding quotes at all, or making the > read/restore/recovery process equally recursive. Stand by... And the solution needs to be making the process equally recursive, because right now it's entirely possible that other packages could start using eieio-persistent with weird data structures, and fall afoul of this asymmetry. It's not just about quotes: if another package starts stashing EIEIO objects inside nested hash tables, they will be written correctly, but read incorrectly. My next stab at a fix is in the attached patch. Michael, assuming I haven't exhausted your patience, would you mind giving this a try? I do believe this is the right solution, or at least the best minimal solution. Eric --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=anotherfix.diff diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el index 9f9f870a75..75709ddc0a 100644 --- a/lisp/emacs-lisp/eieio-base.el +++ b/lisp/emacs-lisp/eieio-base.el @@ -360,32 +360,30 @@ eieio-persistent-validate/fix-slot-value proposed-value)))) ;; For hash-tables and vectors, the top-level `read' will not ;; "look inside" member values, so we need to do that - ;; explicitly. + ;; explicitly. Because `eieio-override-prin1' is recursive in + ;; the case of hash-tables and vectors, we recurse + ;; `eieio-persistent-validate/fix-slot-value' here as well. ((hash-table-p proposed-value) (maphash (lambda (key value) - (cond ((class-p (car-safe value)) - (setf (gethash key proposed-value) - (eieio-persistent-convert-list-to-object - value))) - ((and (consp value) - (eq (car value) 'quote)) - (setf (gethash key proposed-value) - (cadr value))))) + (setf (gethash key proposed-value) + (if (class-p (car-safe value)) + (eieio-persistent-convert-list-to-object + value) + (eieio-persistent-validate/fix-slot-value + class slot value)))) proposed-value) proposed-value) ((vectorp proposed-value) (dotimes (i (length proposed-value)) (let ((val (aref proposed-value i))) - (cond ((class-p (car-safe val)) - (aset proposed-value i - (eieio-persistent-convert-list-to-object - (aref proposed-value i)))) - ((and (consp val) - (eq (car val) 'quote)) - (aset proposed-value i - (cadr val)))))) + (aset proposed-value i + (if (class-p (car-safe val)) + (eieio-persistent-convert-list-to-object + val) + (eieio-persistent-validate/fix-slot-value + class slot val))))) proposed-value) ((stringp proposed-value) --=-=-=--