Synch to No Gnus 200405202205.
[elisp/gnus.git-] / lisp / message.el
index 1b9ea30..60aeda9 100644 (file)
@@ -1688,15 +1688,15 @@ no, only reply back to the author."
   "A regexp that matches the separator before the text of a failed message.")
 
 (defvar message-field-fillers
-  '((To message-fill-address)
-    (Cc message-fill-address)
-    (From message-fill-address))
+  '((To message-fill-field-address)
+    (Cc message-fill-field-address)
+    (From message-fill-field-address))
   "Alist of header names/filler functions.")
 
 (defvar message-header-format-alist
   `((Newsgroups)
-    (To . message-fill-address)
-    (Cc . message-fill-address)
+    (To)
+    (Cc)
     (Subject)
     (In-Reply-To)
     (Fcc)
@@ -5494,9 +5494,9 @@ subscribed address (and not the additional To and Cc header contents)."
     (when field
       (dolist (address (mail-header-parse-addresses field))
        (setq address (car address)
-             rhs (cadr (split-string address "@"))
-             ace (idna-to-ascii rhs))
-       (when (and (not (equalp rhs ace))
+             rhs (downcase (cadr (split-string address "@")))
+             ace (downcase (idna-to-ascii rhs)))
+       (when (and (not (equal rhs ace))
                   (or (not (eq message-use-idna 'ask))
                       (y-or-n-p (format "Replace %s with %s? " rhs ace))))
          (goto-char (point-min))
@@ -5626,8 +5626,9 @@ Headers already prepared in the buffer are not modified."
                      (if formatter
                          (funcall formatter header value)
                        (insert header-string ": " value))
+                     (goto-char (message-fill-field))
                      ;; We check whether the value was ended by a
-                     ;; newline.  If now, we insert one.
+                     ;; newline.  If not, we insert one.
                      (unless (bolp)
                        (insert "\n"))
                      (forward-line -1)))
@@ -5639,8 +5640,7 @@ Headers already prepared in the buffer are not modified."
                (unless optionalp
                  (push header-string message-inserted-headers)
                  (insert value)
-                 (when (bolp)
-                   (delete-char -1))))
+                 (message-fill-field)))
              ;; Add the deletable property to the headers that require it.
              (and (memq header message-deletable-headers)
                   (progn (beginning-of-line) (looking-at "[^:]+: "))
@@ -5736,12 +5736,10 @@ If the current line has `message-yank-prefix', insert it on the new line."
     (error
      (split-line))))
 
-(defun message-fill-header (header value)
+(defun message-insert-header (header value)
   (insert (capitalize (symbol-name header))
          ": "
-         (if (consp value) (car value) value)
-         "\n")
-  (message-fill-field))
+         (if (consp value) (car value) value)))
 
 (defun message-field-name ()
   (save-excursion
@@ -5755,7 +5753,8 @@ If the current line has `message-yank-prefix', insert it on the new line."
       (message-narrow-to-field)
       (let ((field-name (message-field-name)))
        (funcall (or (cadr (assq field-name message-field-fillers))
-                    'message-fill-field-general))))))
+                    'message-fill-field-general)))
+      (point-max))))
 
 (defun message-fill-field-address ()
   (while (not (eobp))
@@ -5832,12 +5831,13 @@ they are."
     (when message-this-is-news
       (while (< 998
                (with-temp-buffer
-                 (message-fill-header header (mapconcat #'identity refs " "))
+                 (message-insert-header
+                  header (mapconcat #'identity refs " "))
                  (buffer-size)))
        (message-shorten-1 refs cut 1)))
     ;; Finally, collect the references back into a string and insert
     ;; it into the buffer.
-    (message-fill-header header (mapconcat #'identity refs " "))))
+    (message-insert-header header (mapconcat #'identity refs " "))))
 
 (defun message-position-point ()
   "Move point to where the user probably wants to find it."