unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Any way to control which articles Gnus summary shows by default?
Date: Sun, 08 Apr 2018 16:59:13 -0700	[thread overview]
Message-ID: <87h8olmer2.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87woxhmsim.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 08 Apr 2018 12:01:53 -0700")

[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: anotherfix.diff --]
[-- Type: text/x-patch, Size: 2320 bytes --]

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)

  reply	other threads:[~2018-04-08 23:59 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.11583.1522744082.27995.help-gnu-emacs@gnu.org>
2018-04-03 23:17 ` Any way to control which articles Gnus summary shows by default? Emanuel Berg
2018-04-03 23:28   ` Emanuel Berg
2018-04-04  7:00   ` Michael Heerdegen
2018-04-04  7:30     ` Eric Abrahamsen
2018-04-04 10:59       ` Michael Heerdegen
2018-04-04 11:31         ` Eric Abrahamsen
2018-04-04 14:41           ` Michael Heerdegen
2018-04-04 14:46             ` Michael Heerdegen
2018-04-06 14:52             ` Michael Heerdegen
2018-04-06 15:22               ` Eric Abrahamsen
2018-04-06 17:53                 ` Eric Abrahamsen
2018-04-06 18:06                   ` Eric Abrahamsen
2018-04-07  9:26                     ` Michael Heerdegen
2018-04-07 12:33                       ` Michael Heerdegen
2018-04-07  9:23                   ` Michael Heerdegen
2018-04-08 14:17                   ` Michael Heerdegen
2018-04-08 15:03                     ` Eric Abrahamsen
2018-04-08 15:46                       ` Michael Heerdegen
2018-04-08 16:57                         ` Eric Abrahamsen
2018-04-08 19:01                         ` Eric Abrahamsen
2018-04-08 23:59                           ` Eric Abrahamsen [this message]
2018-04-09 14:12                             ` Michael Heerdegen
2018-04-09 16:36                               ` Eric Abrahamsen
2018-04-09 19:59                                 ` Michael Heerdegen
2018-04-09 20:18                                   ` Eric Abrahamsen
2018-04-10 12:15                                     ` Michael Heerdegen
2018-04-10 16:27                                       ` Eric Abrahamsen
2018-04-10 20:12                                         ` Michael Heerdegen
2018-04-10 22:29                                           ` Eric Abrahamsen
2018-04-11 17:05                                             ` Michael Heerdegen
     [not found]     ` <mailman.11665.1522827199.27995.help-gnu-emacs@gnu.org>
2018-04-04 12:43       ` Emanuel Berg
2018-04-06 17:53         ` Eric Abrahamsen
2018-07-24  3:10       ` Robert Girault
     [not found]   ` <mailman.11664.1522825278.27995.help-gnu-emacs@gnu.org>
2018-04-04 12:51     ` Emanuel Berg
2018-04-04 14:33       ` Michael Heerdegen
     [not found]       ` <mailman.11689.1522852442.27995.help-gnu-emacs@gnu.org>
2018-04-04 14:48         ` Emanuel Berg
2018-04-03  8:27 Michael Heerdegen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87h8olmer2.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).