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

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

bug#38000: 27.0.50; [PATCH] WIP on using gnus info accessor macros


From: Eric Abrahamsen
Subject: bug#38000: 27.0.50; [PATCH] WIP on using gnus info accessor macros
Date: Fri, 01 Nov 2019 15:52:44 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> Huh, I didn't realize that list-based structs didn't put a tag in the
>>> `car' position unless you pass the :named keyword.
>>>
>>> We could switch to list-based structs without breaking out-of-tree code,
>>> but I don't see much point: you can't use them for generic function
>>> dispatch, even when they're :named, nor do you get a NAME-p predicate
>>> for free. That doesn't leave much point.
>>
>> It means that you don't have to write the accessor macros by hand.  :-)
>
> But you already did! :)
>
> Okay, let's use them anyway. And I'd like to move the "extend" and
> "vacuum" procedures to the reading and writing of the newsrc.eld file,
> so the rest of the code can forget about it. I'll leave the setter
> macros in place, and continue to accept (and ignore) an EXTEND argument,
> so other people's code continues to work.

Okay, here's what the patch looks like now.

1. gnus-info is defined with defstruct, and the constructor arglist
looks like: (group rank read &optional marks method params), meaning
that if you have an info list that may or may not be fully extended, you
can run it through the constructor and all the missing elements will be
set to their default (nil).

2. This is done when reading the newsrc.eld file (and creating new
groups), and all the other uses of the 'extend argument have been
removed.`

3. The bit that chops off nils from the end of infos has been moved from
`gnus-update-marks' to `gnus-gnus-to-quick-newsrc-format', so it only
happens right at the last minute, when saving.

4. I've changed `gnus-set-info' to update each element of an info
individually, rather than just replacing the whole thing. This looks
stupid, but preserves object reference, meaning we no longer need to mess
with the `gnus-newsrc-alist' in `gnus-group-set-info', which was causing
trouble for people. It's going to be a bit slower, but I don't think this is
super performance-crucial.

I think that's it... This still needs some testing, but I'm optimistic.

Attachment: 0001-WIP-on-using-gnus-info-accessors.patch
Description: Text Data


reply via email to

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