GNU bug report logs -
#38000
27.0.50; [PATCH] WIP on using gnus info accessor macros
Previous Next
Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Date: Thu, 31 Oct 2019 00:00:02 UTC
Severity: normal
Tags: patch
Found in version 27.0.50
Fixed in version 27.1
Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Bug is archived. No further changes may be made.
Full log
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
> The attached patch is a work-in-progress for making sure that all of
> Gnus' code only accesses group infos via the relevant macros --
> essentially hiding the fact that group infos are implemented as lists,
> in anticipation of eventually being able to re-implement them as structs
> at some point in the future.
>
> Essentially, "(nth 3 info)" becomes "(gnus-info-marks info)", and so
> one.
>
> It also replaces uses of "gnus-info-set-*" with "(setf (gnus-info-* ".
> The setter macros aren't deprecated, though.
Sounds good, but you can do this with the cl-defstruct list thing
already without changing what the data is.
(cl-defstruct (gnus-info
(:constructor make-gnus-info)
(:copier nil)
(:type list))
(group ...))
Actually changing the data format itself I'm not very enthusiastic
about. There's tons of out-of-tree code that would break.
> If I could understand why _some_ of the infos are expected to be short a
> few elements (newly-created groups?), I would rather provide a
> `make-gnus-info' function (again, in anticipation of a struct
> constructor), which could be called with the elements of an info (either
> as a list or spread) and return an info filled-out with nils where
> necessary. Then that could be used wherever we expect a short info.
I think it's just because the data is written to .newsrc.eld as is, and
writing a bunch of nils there would make the file a lot bigger.
Remember, people may have thousands of groups.
> One last bit I'm uncertain about is in `nnvirtual-request-update-info',
> where I've replaced this:
>
> (setcar (cddr info) nnvirtual-mapping-reads)
> (if (nthcdr 3 info)
> (setcar (nthcdr 3 info) nnvirtual-mapping-marks)
> (when nnvirtual-mapping-marks
> (setcdr (nthcdr 2 info) (list nnvirtual-mapping-marks))))
>
> with this:
>
> (setf (gnus-info-read info) nnvirtual-mapping-reads)
> (when nnvirtual-mapping-marks
> (setf (gnus-info-marks info) nnvirtual-mapping-marks))
>
> It seems to work fine, but to be honest I don't really understand the
> original logic.
I don't understand it either, but it's setting both the second and the
fourth slot, isn't it?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 5 years and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.