[Top][All Lists]

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

Re: per group value of gnus-summary-thread-gathering-function?

From: Giorgos Keramidas
Subject: Re: per group value of gnus-summary-thread-gathering-function?
Date: Thu, 24 Jul 2008 20:53:58 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix)

On Thu, 24 Jul 2008 19:37:49 +0300, Giorgos Keramidas 
<> wrote:
> On Wed, 23 Jul 2008 07:52:14 -0500, Ted Zlatanov <> wrote:
>> On Tue, 22 Jul 2008 17:48:29 +0300 Giorgos Keramidas 
>> <> wrote:
>> GK> What is the recommended way of getting different thread gathering
>> GK> logic for some of the groups?
>> I don't know if there's a standard way; I do it in the summary entry
>> hook based on the newsgroup name.
> Thank you Ted,
> [...]
> maybe it's worth trying to patch Gnus and add some sort of wrapper
> function that dispatches on the group name, i.e.:
>   (setq-default gnus-summary-thread-gathering-function
>                 'keramida-gnus-gather-threads)

Great...  Apparently, with a bit of Lisp, this works fine!

I added this to my `~/.gnus' file now:

  ;;; Threading customizations.

  (defun keramida-gnus-gather-threads-default (threads)
    "The default thread-gathering function for Gnus groups."
    (gnus-gather-threads-by-references threads))

  (defvar keramida-gnus-group-thread-function-map
    '(("mail\\.freebsd\\.bugs" . gnus-gather-threads-by-subject))
    "Custom per-group mapping of Gnus group names to thread gathering

  (defun keramida-gnus-gather-threads (threads)
    "Dispatch function that matches Gnus group names to thread
  gathering functions by looking up the group name in the
    (let ((group gnus-newsgroup-name)
          (gather-function (or (and (fboundp 
                               (and (fboundp 'gnus-gather-threads-by-references)
      (let ((match-function nil))
        (if (and group (boundp 'keramida-gnus-group-thread-function-map))
            (dolist (pair keramida-gnus-group-thread-function-map)
              (message "pair is %s" pair)
              (if (not match-function)
                  (let ((pattern (car pair))
                        (func (cdr pair)))
                    (if (and (string-match pattern group)
                             (fboundp func))
                        (setq match-function func))))))
        (if match-function
            (setq gather-function match-function)))
      (funcall gather-function threads)))

  ;; Use my own thread-gathering function.
  (setq gnus-summary-thread-gathering-function

This seems to have worked great so far.  All my groups gather threads by
looking at references, and "mail.freebsd.bugs" gathers threads by looking
at the email subject.

It's probably not as polished as it could be, and it will iterate over the
entire list of (pattern . function) pairs, even if it has already found a
match, but I can live with that for now.

reply via email to

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