Lars Ingebrigtsen writes: > Alex Bochannek 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. Looks good, thank you! I originally had duplicated that code from `gnus-article-sort-by-recipient' and it's probably a good idea to make that into a utility function.