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

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

bug#38011: 27.0.50; [PATCH] WIP on allowing Gnus backends to return head


From: Lars Ingebrigtsen
Subject: bug#38011: 27.0.50; [PATCH] WIP on allowing Gnus backends to return header data directly
Date: Sun, 27 Sep 2020 14:16:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>> Xref: reader01.eternal-september.org foo.bar:2523 gnu.emacs.help:57603 
>> zot.bar:3242

[...]

> Slowly, slowly, I'm getting this done. I'm still a bit confused here,
> though. The xref elements look like they're not supposed to have spaces
> in them, but the existing code does this:
>
> (insert "Xref: " sysname " " group ":")
> (princ article (current-buffer))
>
> Which leaves a space between sysname and group.

I'm not quite sure I understand the question?  The sysname is just a
part of the syntax of the Xref header and isn't used for anything by
Gnus, as far as I know.  So there has to be a space?  It's certainly not
part of the group name.

> You say the existing xrefs should be left as they are, but the code adds
> "prefix" to them. Should this be added unconditionally?

Uhm...  I think so?  But I'm not sure.

> Here's the new version of the function, operating on a header struct.
> Does this look right to you?
>
> Thanks,
> Eric
>
> (defun nnvirtual-update-xref-header (header group prefix sysname)
>   "Add xref to component GROUP to HEADER.
> Also add a server PREFIX any existing xref lines."
>   (let ((bits (split-string (mail-header-xref header)
>                           nil t "[[:blank:]]"))
>       (art-no (mail-header-number header)))
>     (setq bits
>         (mapcar (lambda (bit)
>                   (concat prefix bit))
>                 bits))
>     (setf (mail-header-xref header)
>         (mapconcat #'identity
>                    (cons (format "%s %s:%d"
>                                    sysname group art-no)
>                          bits)
>                    " "))))

I think so.  The body of the let form is perhaps more easily expressed
as

(setf (mail-header-xref header)
      (concat (format "%s %s:%d " sysname group art-no)
              (mapconcat (lambda (bit)
                           (concat prefix bit))
                         bits " ")))

?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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