From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/54785 Path: main.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.gnus.general Subject: Re: follow-up & CC Date: Wed, 12 Nov 2003 13:36:20 -0500 Organization: disorganization Sender: ding-owner@lists.math.uh.edu Message-ID: References: Reply-To: sds@gnu.org NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1068662227 22025 80.91.224.253 (12 Nov 2003 18:37:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Nov 2003 18:37:07 +0000 (UTC) Original-X-From: ding-owner+M3326@lists.math.uh.edu Wed Nov 12 19:37:04 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AJzrU-0003RS-00 for ; Wed, 12 Nov 2003 19:37:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1AJzr0-0000oP-00; Wed, 12 Nov 2003 12:36:34 -0600 Original-Received: from justine.libertine.org ([66.139.78.221]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1AJzqr-0000oH-00 for ding@lists.math.uh.edu; Wed, 12 Nov 2003 12:36:25 -0600 Original-Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by justine.libertine.org (Postfix) with ESMTP id 047623A004F for ; Wed, 12 Nov 2003 12:36:24 -0600 (CST) Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AJzqo-0003D0-00 for ; Wed, 12 Nov 2003 19:36:22 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: ding@gnus.org Original-Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AJzqm-0003Cq-00 for ; Wed, 12 Nov 2003 19:36:20 +0100 Original-Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AJzqm-0005hZ-00 for ; Wed, 12 Nov 2003 19:36:20 +0100 Original-Lines: 72 Original-X-Complaints-To: usenet@sea.gmane.org X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:gSPQVAaWwC246Z9V/QMXgDb36SM= Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:54785 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:54785 > * Reiner Steib <4.hpr.03.e.f@aheshrefcnz.qr> [2003-11-12 17:54:10 +0100]: > > On Wed, Nov 12 2003, Sam Steingold wrote: > >> there appears to be a bug in `message-carefully-insert-headers': it >> does not check that the recipient is already mentioned in To or CC, so >> subsequent C-c C-t will just insert more and more identical To: >> addresses. > > I guess `message-insert-to' isn't supposed to be called repeatedly. > But if you (or anyone else) want to implement such checks in > `message-carefully-insert-headers'... ;-) Patch appended. >> Another dubious element is that `gnus-message' is defined in >> gnus-util.el which is not required by message.el. >> I think you need to add an autoload statement >> (autoload 'gnus-message "gnus-util") >> to the beginning of message.el. > > I will change `gnus-message 3' to `message'. `message.el' is supposed > to be independent from Gnus. Thanks for pointing this out. actually, message.el autoloads quite a few gnus-util.el and other functions. -- Sam Steingold (http://www.podval.org/~sds) running w2k ((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x)))) --- message.el.~6.380.~ 2003-11-10 15:26:08.612774400 -0500 +++ message.el 2003-11-12 13:35:06.653238500 -0500 @@ -2599,15 +2599,31 @@ (message-get-reply-headers t)))) (message-carefully-insert-headers headers))) +(defvar message-header-synonyms + '((To Cc Bcc)) + "List of lists of header synonyms. +E.g., if this list contains a member list with elements `Cc' and `To', +then `message-carefully-insert-headers' will not insert a `To' header +when the message is already `Cc'ed to the recipient.") + (defun message-carefully-insert-headers (headers) (dolist (header headers) - (let ((header-name (symbol-name (car header)))) + (let* ((header-name (symbol-name (car header))) + (new-header (cdr header)) + (synonyms (loop for synonym in message-header-synonyms + when (memq (car header) synonym) return synonym)) + (old-header + (loop for synonym in synonyms + for old-header = (mail-fetch-field (symbol-name synonym)) + when (string-match new-header old-header) + return synonym))) + (if old-header + (message "already have `%s' in `%s'" new-header old-header) (when (and (message-position-on-field header-name) - (mail-fetch-field header-name) - (not (string-match "\\` *\\'" - (mail-fetch-field header-name)))) + (setq old-header (mail-fetch-field header-name)) + (not (string-match "\\` *\\'" old-header))) (insert ", ")) - (insert (cdr header))))) + (insert new-header))))) (defun message-widen-reply () "Widen the reply to include maximum recipients."