Gnus development mailing list
 help / color / mirror / Atom feed
From: Sam Steingold <sds@gnu.org>
Subject: Re: follow-up & CC
Date: Wed, 12 Nov 2003 13:36:20 -0500	[thread overview]
Message-ID: <un0b1e8nv.fsf@gnu.org> (raw)
In-Reply-To: <v94qx97cjx.fsf@marauder.physik.uni-ulm.de>

> * 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
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
((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."




  reply	other threads:[~2003-11-12 18:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-10  1:18 Sam Steingold
2003-11-10 12:30 ` Reiner Steib
2003-11-10 14:47   ` Sam Steingold
2003-11-10 17:44     ` Reiner Steib
2003-11-10 18:04       ` Sam Steingold
2003-11-10 18:54         ` Reiner Steib
2003-11-10 19:12           ` Sam Steingold
2003-11-10 19:26           ` Sam Steingold
2003-11-10 20:26             ` Reiner Steib
2003-11-12 16:05               ` Sam Steingold
2003-11-12 16:54                 ` Reiner Steib
2003-11-12 18:36                   ` Sam Steingold [this message]
2003-11-12 20:00                     ` Reiner Steib
2003-11-12 21:13                       ` Sam Steingold
2003-11-18 16:05                         ` Reiner Steib
2003-11-18 18:50                           ` Sam Steingold
2003-11-18 19:57                             ` Reiner Steib
2003-11-18 20:47                               ` Sam Steingold
2004-01-03 14:07                                 ` Reiner Steib

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=un0b1e8nv.fsf@gnu.org \
    --to=sds@gnu.org \
    /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).