GNU bug report logs - #49081
28.0.50; [PATCH] Feature suggestion, Gnus summary mode sorting for extra headers

Previous Next

Package: emacs;

Reported by: Alex Bochannek <alex <at> bochannek.com>

Date: Thu, 17 Jun 2021 23:54:02 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alex Bochannek <alex <at> bochannek.com>
Cc: 49081 <at> debbugs.gnu.org
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
Alex Bochannek <alex <at> 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




This bug report was last modified 3 years and 334 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.