From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/42874 Path: main.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: possible strange idea about hierarchical lists Date: Fri, 01 Feb 2002 17:14:35 -0500 Organization: =?koi8-r?q?=F4=C5=CF=C4=CF=D2=20=FA=CC=C1=D4=C1=CE=CF=D7?= @ Cienfuegos Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035178057 14537 80.91.224.250 (21 Oct 2002 05:27:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 05:27:37 +0000 (UTC) Return-Path: Original-Received: (qmail 8729 invoked from network); 1 Feb 2002 22:50:32 -0000 Original-Received: from malifon.math.uh.edu (mail@129.7.128.13) by mastaler.com with SMTP; 1 Feb 2002 22:50:32 -0000 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 16Wm72-0000xK-00; Fri, 01 Feb 2002 16:24:52 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Fri, 01 Feb 2002 16:24:37 -0600 (CST) Original-Received: from sclp3.sclp.com (sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id QAA10438 for ; Fri, 1 Feb 2002 16:22:38 -0600 (CST) Original-Received: (qmail 7697 invoked by alias); 1 Feb 2002 22:15:12 -0000 Original-Received: (qmail 7692 invoked from network); 1 Feb 2002 22:15:12 -0000 Original-Received: from liilmtlssm01.mailtask.com (208.203.59.25) by gnus.org with SMTP; 1 Feb 2002 22:15:12 -0000 Original-Received: from LIILMTLSFE02.mailtask.com ([208.203.59.43]) by LIILMTLSSM01.mailtask.com with Microsoft SMTPSVC(5.0.2195.3779); Fri, 1 Feb 2002 16:14:45 -0600 Original-Received: from onyx.nimbus.northernlight.com ([10.128.22.65]) by LIILMTLSFE02.mailtask.com with Microsoft SMTPSVC(5.0.2195.3779); Fri, 1 Feb 2002 16:14:44 -0600 Original-To: ding@gnus.org X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Followup-To: ding@gnus.org Original-Lines: 70 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (i386-redhat-linux-gnu) X-OriginalArrivalTime: 01 Feb 2002 22:14:45.0044 (UTC) FILETIME=[DA9AAF40:01C1AB6D] Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:42874 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:42874 --=-=-= prj@po.cwru.edu (Paul Jarc) writes: > How about this: > (let* ((recipients '(("foo@bar" . "Name ") > ("baz@quux" . "None "))) > (plain-addrs (mapcar 'car recipients)) > (gnus-hierarchical-lists '(("baz@quux" "foo@bar"))) > sublists recip) > (while plain-addrs > (setq sublists (assoc (car plain-addrs) gnus-hierarchical-lists) > plain-addrs (cdr plain-addrs)) > (when sublists > (setq sublists (cdr sublists)) > (while sublists > (setq recip (assoc (car sublists) recipients) > sublists (cdr sublists)) > (if recip > (setq recipients (delq recip recipients))))))) > > Note that this is a different structure for gnus-hierarchical-lists. > An entry (A B C) means that A contains B and C. (No further > relationship between B and C is implied.) So if A appears in the > recipient list, then B and C will be removed from it, if present. If > B and C have sublists of their own, they should get their own > top-level entries in gnus-hierarchical-lists. In this case, > gnus-hierarchical-lists says that messages to baz@quux also go to > foo@bar, so foo@bar is removed from the recipient list. That looks fine to me. Kai, sorry for not following up to your very helpful message. I was unable to send e-mail to the ding list for a while due to server problems. I think Paul's suggestion is even better to make the user's life simple, using a list instead of a cons cell. I tried to put a patch into message.el, naming the variables accordingly and simplifying things a bit. I'm not sure if the variable should go into the message-headers or the message-sending group; also, I'm not sure if I defined the variable correctly with defcustom (I tried the '(repeat sexp) type but that didn't work). I think the functional definition, at least, is correct (because Paul wrote it :) I did a diff -u, renaming the original message.el to message-original.el because I don't have access to the CVS repository (firewall issues, don't ask) to do a diff against it. This is my first time submitting a patch, please let me know if I did anything wrong. It's also my first time writing more than 4 lines of Lisp for a single purpose. To test, define message-hierarchical-lists to be ("foo" "bar") and then have "foo" and "bar" in your recipient list. "bar" should be removed. I couldn't test - message-get-reply-headers was not invoked, according to debug-on-entry. I'm kind of puzzled by this. I must be doing something wrong. Also, the message-hierarchical-lists should probably be generalized to regular expressions for both the primary and secondary lists (message-hierarchical-lists-regexps?). I don't need this personally, but perhaps someone else will find it useful. Maybe when the string exact matching is working. Thanks Ted --=-=-= Content-Disposition: attachment; filename=message-hierarchical-patch Content-Description: patch for message.el --- message-original.el Fri Feb 1 16:07:38 2002 +++ message.el Fri Feb 1 17:11:14 2002 @@ -1044,6 +1044,15 @@ :type '(choice (const :tag "Always use primary" nil) regexp)) +(defcustom message-hierarchical-lists nil + "A list of hierarchical mailing list definitions. + +Inside each entry, the first address is the top list, everything after +it are secondary addresses contained in the list. The secondaries +will be removed from the list of recipients when mail is prepared for +delivery." + :group 'message-headers) + (defcustom message-mail-user-agent nil "Like `mail-user-agent'. Except if it is nil, use Gnus native MUA; if it is t, use @@ -4512,6 +4521,23 @@ (let ((s recipients)) (while s (setq recipients (delq (assoc (car (pop s)) s) recipients)))) + + ;; remove hierarchical lists that are contained within each other, + ;; if message-hierarchical-lists is defined + (when message-hierarchical-lists + (let* ((plain-addrs (mapcar 'car recipients)) + sublists recip) + (while plain-addrs + (setq sublists (assoc (car plain-addrs) message-hierarchical-lists) + plain-addrs (cdr plain-addrs)) + (when sublists + (setq sublists (cdr sublists)) + (while sublists + (setq recip (assoc (car sublists) recipients) + sublists (cdr sublists)) + (if recip + (setq recipients (delq recip recipients)))))))) + ;; Build the header alist. Allow the user to be asked whether ;; or not to reply to all recipients in a wide reply. (setq follow-to (list (cons 'To (cdr (pop recipients))))) --=-=-=--