GNU bug report logs - #38000
27.0.50; [PATCH] WIP on using gnus info accessor macros

Previous Next

Package: emacs;

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 #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: 27.0.50; [PATCH] WIP on using gnus info accessor macros
Date: Wed, 30 Oct 2019 16:58:52 -0700
[Message part 1 (text/plain, inline)]
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.

My main question is about the use of the EXTEND argument to
`gnus-info-set-marks', `gnus-info-set-method', and
`gnus-info-set-params'. In the current patch, I have left the setter
intact wherever the EXTEND argument is passed, until I can figure this
out.

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.

There's also the weird spot in gnus-sum.el:6183 where we're chopping off
nil elements from the end of an info list, I don't know why.

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.

Eric

[0001-WIP-on-using-gnus-info-accessors.patch (text/x-patch, attachment)]

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.