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

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

bug#49081: 28.0.50; [PATCH] Feature suggestion, Gnus summary mode sortin


From: Lars Ingebrigtsen
Subject: bug#49081: 28.0.50; [PATCH] Feature suggestion, Gnus summary mode sorting for extra headers
Date: Sat, 19 Jun 2021 15:14:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Alex Bochannek <alex@bochannek.com> writes:

> Since I was able to get the Newsgroups extra header working for
> `nnvirtual' groups, I would like to not only limit, but also sort by the
> extra headers.

Looks good; applied with one minor tweak:

> +(defun gnus-article-sort-by-newsgroups (h1 h2)
> +  "Sort articles by newsgroups."
> +  (gnus-string<
> +   (let ((extract (funcall
> +                gnus-extract-address-components
> +                (or (cdr (assq 'Newsgroups (mail-header-extra h1))) ""))))
> +     (or (car extract) (cadr extract)))
> +   (let ((extract (funcall
> +                gnus-extract-address-components
> +                (or (cdr (assq 'Newsgroups (mail-header-extra h2))) ""))))
> +     (or (car extract) (cadr extract)))))

I rewrote that to:

(defun gnus-article-sort-by-newsgroups (h1 h2)
  "Sort articles by newsgroups."
  (let ((ex
         (lambda (h)
           (let ((extract
                  (funcall gnus-extract-address-components
                           (or (cdr (assq 'Newsgroups (mail-header-extra h)))
                               ""))))
             (or (car extract) (cadr extract))))))
    (gnus-string< (funcall ex h1) (funcall ex h2))))

To avoid the duplication -- let me know if I messed up that bit.

-- 
(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]