From: Ted Zlatanov <teodor.zlatanov@divine.com>
Subject: Re: possible strange idea about hierarchical lists
Date: Fri, 01 Feb 2002 17:14:35 -0500 [thread overview]
Message-ID: <m34rl0luic.fsf@onyx.nimbus.northernlight.com> (raw)
In-Reply-To: <m3sn8mmc6n.fsf@multivac.cwru.edu>
[-- Attachment #1: Type: text/plain, Size: 2874 bytes --]
prj@po.cwru.edu (Paul Jarc) writes:
> How about this:
> (let* ((recipients '(("foo@bar" . "Name <foo@bar>")
> ("baz@quux" . "None <baz@quux>")))
> (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
[-- Attachment #2: patch for message.el --]
[-- Type: text/plain, Size: 1596 bytes --]
--- 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)))))
next prev parent reply other threads:[~2002-02-01 22:14 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-04 16:59 Ted Zlatanov
2001-12-04 17:31 ` Kai Großjohann
2001-12-04 17:28 ` Ted Zlatanov
2001-12-04 17:44 ` Paul Jarc
2001-12-04 17:38 ` Ted Zlatanov
2001-12-05 8:55 ` Kai Großjohann
2001-12-05 16:52 ` Matt Armstrong
2001-12-07 14:09 ` Ted Zlatanov
2001-12-29 2:02 ` Lars Magne Ingebrigtsen
2002-01-16 19:33 ` Ted Zlatanov
2002-01-16 20:12 ` Ted Zlatanov
2002-01-18 9:18 ` Kai Großjohann
2002-01-31 21:40 ` Paul Jarc
2002-02-01 22:14 ` Ted Zlatanov [this message]
2002-02-02 3:37 ` Paul Jarc
2002-02-25 23:04 ` [patch] hierarchical lists in message.el Ted Zlatanov
2002-02-25 23:22 ` Paul Jarc
2002-02-25 23:22 ` Paul Jarc
2002-02-26 11:40 ` Ted Zlatanov
2002-02-26 11:40 ` Ted Zlatanov
2002-03-01 21:23 ` Paul Jarc
2002-03-04 17:34 ` Ted Zlatanov
2002-03-04 18:11 ` Paul Jarc
2002-03-04 18:11 ` Paul Jarc
2002-03-04 17:34 ` Ted Zlatanov
2002-03-01 21:23 ` Paul Jarc
2002-02-25 23:04 ` Ted Zlatanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m34rl0luic.fsf@onyx.nimbus.northernlight.com \
--to=teodor.zlatanov@divine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).