From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/11222 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.gnus.user Subject: Re: per group value of gnus-summary-thread-gathering-function? Date: Thu, 24 Jul 2008 20:53:58 +0300 Organization: SunSITE.dk - Supporting Open source Message-ID: <87bq0nnp6x.fsf@kobe.laptop> References: <877ibeasaq.fsf@kobe.laptop> <86iquwepa9.fsf@lifelogs.com> <87ljzrck6a.fsf@kobe.laptop> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1216924986 18207 80.91.229.12 (24 Jul 2008 18:43:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Jul 2008 18:43:06 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Thu Jul 24 20:43:56 2008 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KM5n8-0002j6-Sm for gegu-info-gnus-english@m.gmane.org; Thu, 24 Jul 2008 20:43:55 +0200 Original-Received: from localhost ([127.0.0.1]:40063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KM5mE-000323-Jg for gegu-info-gnus-english@m.gmane.org; Thu, 24 Jul 2008 14:42:58 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!zen.net.uk!dedekind.zen.co.uk!news.banetele.no!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Original-Newsgroups: gnu.emacs.gnus User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) Cancel-Lock: sha1:pGXI6mODrrvzTiJ2voAUPCgXT9Y= Original-Lines: 67 Original-NNTP-Posting-Host: 77.49.178.184 Original-X-Trace: news.sunsite.dk DXC=Z9KlPk; cd\][eoV[BRG`:]YSB=nbEKnk[l:4`YVO27`_L^MjWbH?lJH1Tkj\K1@Bmk`CVSZS?Z0?6`aYHY Original-X-Complaints-To: staff@sunsite.dk Original-Xref: news.stanford.edu gnu.emacs.gnus:81442 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.gnus.user:11222 Archived-At: 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 functions.") (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 `keramida-gnus-group-thread-function-map'." (let ((group gnus-newsgroup-name) (gather-function (or (and (fboundp 'keramida-gnus-gather-threads-default) (function keramida-gnus-gather-threads-default)) (and (fboundp 'gnus-gather-threads-by-references) (function 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 'keramida-gnus-gather-threads) 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.