help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any way to control which articles Gnus summary shows by default?


From: Eric Abrahamsen
Subject: Re: Any way to control which articles Gnus summary shows by default?
Date: Mon, 09 Apr 2018 13:18:05 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> Eric Abrahamsen <address@hidden> writes:
>
>> > FWIW, when I read the sources, I got the impression that all conses are
>> > handled as if they were true lists.  Trying to save conses whose cdr is
>> > not consp will probably error, since the current code always seems to
>         ^^^^^
>         listp
>
> Sorry, that was a typo.
>
>> You mean values like '(bob)? This seems to work okay:
>
> No, I mean something that is not a regular list like (bob . alice), or
> an alist with atomic values, like
>
>   ((a . 1) (b . 2))
>
> Haven't tried it, though.

The same test code switching '(bob) to '(bob . alice) also works just
fine.

But do keep in mind that I'm not trying to find more bugs in the
current implementation -- there are all kinds of values that won't work
correctly. All I'm trying to do with the current version is get it
balanced between writing and restoring. The next step is to toss it out
completely and write something simpler.

The process as I'd like to have it looks more like (with code for
backwards compatibility removed):

(defun eieio-persistent-fix-value (value)
  (let (result)
    (when (consp value)
      (if (class-p (car value))
          (setq result
                (eieio-persistent-make-instance (car value) (cdr value))
                value nil)
        (while (consp value)
          (push (eieio-persistent-fix-value (car value)) result)
          (setq value (cdr value)))))
    (if (eieio-object-p result)
        result
      (nconc (nreverse result)
             (if (stringp value)
                 (substring-no-properties value)
               value)))))

That should be all that's needed. One of the discussions now is whether
it's okay to just check (class-p (car value)), or whether there should
be a more explicit flag saying "this list should actually be turned into
an object".

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]