(gnus-point-at-bol, gnus-point-at-eol): Remove.
[gnus] / lisp / message.el
index 3767836..6ed9f0d 100644 (file)
@@ -1,5 +1,5 @@
 ;;; message.el --- composing mail and news messages
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -1535,8 +1535,6 @@ no, only reply back to the author."
   (autoload 'message-setup-toolbar "messagexmas")
   (autoload 'mh-new-draft-name "mh-comp")
   (autoload 'mh-send-letter "mh-comp")
-  (autoload 'gnus-point-at-eol "gnus-util")
-  (autoload 'gnus-point-at-bol "gnus-util")
   (autoload 'gnus-output-to-rmail "gnus-util")
   (autoload 'gnus-output-to-mail "gnus-util")
   (autoload 'nndraft-request-associate-buffer "nndraft")
@@ -1550,7 +1548,8 @@ no, only reply back to the author."
   (autoload 'gnus-groups-from-server "gnus")
   (autoload 'rmail-output "rmailout")
   (autoload 'gnus-delay-article "gnus-delay")
-  (autoload 'gnus-make-local-hook "gnus-util"))
+  (autoload 'gnus-make-local-hook "gnus-util")
+  (autoload 'gnus-extract-address-components "gnus-util"))
 
 \f
 
@@ -2672,17 +2671,23 @@ prefix FORCE is given."
                   (message-get-reply-headers t))))
     (message-carefully-insert-headers headers)))
 
-(defvar message-header-synonyms
+(defcustom 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.")
+when the message is already `Cc'ed to the recipient."
+  :group 'message-headers
+  :link '(custom-manual "(message)Message Headers")
+  :type '(repeat sexp))
 
 (defun message-carefully-insert-headers (headers)
   "Insert the HEADERS, an alist, into the message buffer.
 Does not insert the headers when they are already present there
 or in the synonym headers, defined by `message-header-synonyms'."
+  ;; FIXME: Should compare only the address and not the full name.  Comparison
+  ;; should be done case-folded (and with `string=' rather than
+  ;; `string-match').
   (dolist (header headers)
     (let* ((header-name (symbol-name (car header)))
            (new-header (cdr header))
@@ -3150,7 +3155,7 @@ prefix, and don't delete any headers."
 (defun message-yank-buffer (buffer)
   "Insert BUFFER into the current buffer and quote it."
   (interactive "bYank buffer: ")
-  (let ((message-reply-buffer buffer))
+  (let ((message-reply-buffer (get-buffer buffer)))
     (save-window-excursion
       (message-yank-original))))
 
@@ -3495,9 +3500,11 @@ It should typically alter the sending method in some way or other."
        (when (let ((char (char-after)))
                (or (< (mm-char-int char) 128)
                    (and (mm-multibyte-p)
-                        (> (length (mm-find-mime-charset-region
-                                    (point) (point-max)))
-                           1))))
+                        (memq (char-charset char)
+                              '(eight-bit-control eight-bit-graphic
+                                                  control-1))
+                        (not (get-text-property
+                              (point) 'untranslated-utf-8)))))
          (message-overlay-put (message-make-overlay (point) (1+ (point)))
                               'face 'highlight)
          (setq found t))
@@ -3524,7 +3531,9 @@ It should typically alter the sending method in some way or other."
                           ;; use find-coding-systems-region.
                           (memq (char-charset char)
                                 '(eight-bit-control eight-bit-graphic
-                                                    control-1)))))
+                                                    control-1))
+                          (not (get-text-property
+                                (point) 'untranslated-utf-8)))))
            (if (eq choice ?i)
                (message-kill-all-overlays)
              (delete-char 1)
@@ -5044,7 +5053,7 @@ Headers already prepared in the buffer are not modified."
                      (forward-line -1)))
                ;; The value of this header was empty, so we clear
                ;; totally and insert the new value.
-               (delete-region (point) (gnus-point-at-eol))
+               (delete-region (point) (point-at-eol))
                ;; If the header is optional, and the header was
                ;; empty, we con't insert it anyway.
                (unless optionalp
@@ -5144,7 +5153,6 @@ If the current line has `message-yank-prefix', insert it on the new line."
     (error
      (split-line))))
      
-
 (defun message-fill-header (header value)
   (let ((begin (point))
        (fill-column 78)
@@ -5271,7 +5279,7 @@ beginning of line."
           (message-point-in-header-p))
       (let* ((here (point))
             (bol (progn (beginning-of-line n) (point)))
-            (eol (gnus-point-at-eol))
+            (eol (point-at-eol))
             (eoh (re-search-forward ": *" eol t)))
        (if (or (not eoh) (equal here eoh))
            (goto-char bol)
@@ -5578,15 +5586,23 @@ OTHER-HEADERS is an alist of header/value pairs."
 (defun message-get-reply-headers (wide &optional to-address address-headers)
   (let (follow-to mct never-mct to cc author mft recipients)
     ;; Find all relevant headers we need.
-    (setq to (message-fetch-field "to")
-         cc (message-fetch-field "cc")
-         mct (message-fetch-field "mail-copies-to")
-         author (or (message-fetch-field "mail-reply-to")
-                    (message-fetch-field "reply-to")
-                    (message-fetch-field "from")
-                    "")
-         mft (and message-use-mail-followup-to
-                  (message-fetch-field "mail-followup-to")))
+    (save-restriction
+      (message-narrow-to-headers-or-head)
+      ;; Gmane renames "To".  Look at "Original-To", too, if it is present in
+      ;; message-header-synonyms.
+      (setq to (or (message-fetch-field "to")
+                  (and (loop for synonym in message-header-synonyms
+                             when (memq 'Original-To synonym)
+                             return t)
+                       (message-fetch-field "original-to")))
+           cc (message-fetch-field "cc")
+           mct (message-fetch-field "mail-copies-to")
+           author (or (message-fetch-field "mail-reply-to")
+                      (message-fetch-field "reply-to")
+                      (message-fetch-field "from")
+                      "")
+           mft (and message-use-mail-followup-to
+                    (message-fetch-field "mail-followup-to"))))
 
     ;; Handle special values of Mail-Copies-To.
     (when mct
@@ -6049,7 +6065,7 @@ news, Source is the list of newsgroups is was posted to."
         (prefix
          (if group
              (gnus-group-decoded-name group)
-           (or (and from (cdr (mail-header-parse-address from)))
+           (or (and from (car (gnus-extract-address-components from)))
                "(nowhere)"))))
     (concat "["
            (if message-forward-decoded-p