From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/18518 Path: main.gmane.org!not-for-mail From: Kai.Grossjohann@CS.Uni-Dortmund.DE Newsgroups: gmane.emacs.gnus.general Subject: Split replies to go with originals Date: 11 Nov 1998 20:59:54 +0100 Sender: owner-ding@hpc.uh.edu Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035157029 6582 80.91.224.250 (20 Oct 2002 23:37:09 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 23:37:09 +0000 (UTC) Return-Path: Original-Received: from karazm.math.uh.edu (karazm.math.uh.edu [129.7.128.1]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id PAA05391 for ; Wed, 11 Nov 1998 15:00:53 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by karazm.math.uh.edu (8.9.1/8.9.1) with ESMTP id OAB23888; Wed, 11 Nov 1998 14:00:29 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Wed, 11 Nov 1998 14:00:18 -0600 (CST) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [209.195.19.139]) by sina.hpc.uh.edu (8.7.3/8.7.3) with ESMTP id OAA14376 for ; Wed, 11 Nov 1998 14:00:09 -0600 (CST) Original-Received: from waldorf.cs.uni-dortmund.de (waldorf.cs.uni-dortmund.de [129.217.4.42]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id OAA05372 for ; Wed, 11 Nov 1998 14:59:58 -0500 (EST) Original-Received: from ramses.informatik.uni-dortmund.de (ramses.cs.uni-dortmund.de [129.217.20.180]) by waldorf.cs.uni-dortmund.de with SMTP id UAA27649 for ; Wed, 11 Nov 1998 20:59:56 +0100 (MET) Original-Received: (grossjoh@localhost) by ramses.informatik.uni-dortmund.de id UAA28261; Wed, 11 Nov 1998 20:59:56 +0100 Original-To: ding@gnus.org Original-Lines: 97 User-Agent: Gnus/5.070042 (Pterodactyl Gnus v0.42) Emacs/20.3 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:18518 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:18518 Pre-alpha code alert! I have now produced the following patch for pgnus-0.42/lisp/nnmail.el. It is truly horrible code, and almost not tested at all, but it *has* worked for two messages now :-) What does it do? You manually put a message in the foo group (using B m, say). Now, you get a reply for that message, and naturally, you want to put it in the foo group, too. Here's some code which does this if you have nnmail-treat-duplicates set to a non-nil value and if you use nnmail-split-fancy. I have the following in ~/.gnus: ,----- | (setq nnmail-split-fancy | '(| (: nnmail-split-fancy-with-parent) | ---other-split-rules-go-here--- | ) | ) `----- This should be all you need to get going. Please tell me if it works for you, and also don't hesitate to make suggestions for nnmail-cache-insert -- that's the most horrible part. kai -- Life is hard and then you die. --- nnmail.el.ORIG Wed Nov 11 09:59:27 1998 +++ nnmail.el Wed Nov 11 20:51:34 1998 @@ -1484,12 +1484,59 @@ (defun nnmail-cache-insert (id) (when nnmail-treat-duplicates - (unless (gnus-buffer-live-p nnmail-cache-buffer) - (nnmail-cache-open)) + ;; Store some information about the group this message is written + ;; to. This function might have been called from various places. + ;; Sometimes, a function up in the calling sequence has an + ;; argument GROUP which is bound to a string, the group name. At + ;; other times, there is a function up in the calling sequence + ;; which has an argument GROUP-ART which is a list of pairs, and + ;; the car of a pair is a group name. Should we check that the + ;; length of the list is equal to 1? -- kai + (let ((g nil)) + (cond ((and (boundp 'group) group) + (setq g group)) + ((and (boundp 'group-art) group-art (listp group-art)) + (setq g (caar group-art))) + (t (setq g ""))) + (unless (gnus-buffer-live-p nnmail-cache-buffer) + (nnmail-cache-open)) + (save-excursion + (set-buffer nnmail-cache-buffer) + (goto-char (point-max)) + (insert id "\t" g "\n"))))) + +;; Fetch the group name corresponding to the message id stored in the +;; cache. +(defun nnmail-cache-fetch-group (id) + (when (and nnmail-treat-duplicates nnmail-cache-buffer) (save-excursion (set-buffer nnmail-cache-buffer) (goto-char (point-max)) - (insert id "\n")))) + (when (search-backward id nil t) + (beginning-of-line) + (skip-chars-forward "^\n\r\t") + (unless (eolp) + (forward-char 1) + (buffer-substring (point) + (progn (end-of-line) (point)))))))) + +;; Function for nnmail-split-fancy: look up all references in the +;; cache and if a match is found, return that group. +(defun nnmail-split-fancy-with-parent () + (let* ((refstr (or (message-fetch-field "references") + (message-fetch-field "in-reply-to"))) + (references nil) + (res nil)) + (when refstr + (setq references (nreverse (gnus-split-references refstr))) + (unless (gnus-buffer-live-p nnmail-cache-buffer) + (nnmail-cache-open)) + (mapcar (lambda (x) + (setq res (or (nnmail-cache-fetch-group x) res)) + (when (string= "drafts" res) + (setq res nil))) + references) + res))) (defun nnmail-cache-id-exists-p (id) (when nnmail-treat-duplicates