*** empty log message ***
[gnus] / lisp / message.el
index b0cc714..a399e16 100644 (file)
@@ -123,8 +123,7 @@ included.  Organization, Lines and X-Mailer are optional.")
   "*Regexp of headers to be removed unconditionally before mailing.")
 
 ;;;###autoload
-(defvar message-ignored-supersedes-headers
-  "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|Return-Path:"
+(defvar message-ignored-supersedes-headers "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|Return-Path:\\|^Supersedes:"
   "*Header lines matching this regexp will be deleted before posting.
 It's best to delete old Path and Date headers before posting to avoid
 any confusion.")
@@ -253,6 +252,11 @@ always use the value.")
   "Normal hook, run each time a new outgoing message is initialized.
 The function `message-setup' runs this hook.")
 
+(defvar message-signature-setup-hook nil
+  "Normal hook, run each time a new outgoing message is initialized.
+It is run after the headers have been inserted and before 
+the signature is inserted.")
+
 (defvar message-mode-hook nil
   "Hook run in message mode buffers.")
 
@@ -455,8 +459,8 @@ The cdr of ech entry is a function for applying the face to a region.")
 
 (defvar message-header-format-alist 
   `((Newsgroups)
-    (To . message-fill-header
-    (Cc . message-fill-header)
+    (To . message-fill-address
+    (Cc . message-fill-address)
     (Subject)
     (In-Reply-To)
     (Fcc)
@@ -883,6 +887,7 @@ C-c C-r  message-ceasar-buffer-body (rot13 the message body)."
 (defun message-goto-body ()
   "Move point to the beginning of the message body."
   (interactive)
+  (if (looking-at "[ \t]*\n") (expand-abbrev))
   (goto-char (point-min))
   (search-forward (concat "\n" mail-header-separator "\n") nil t))
 
@@ -1539,7 +1544,8 @@ the user from the mailer."
           (if (not hashtb)
               t
             (while groups
-              (unless (boundp (intern (car groups) hashtb))
+              (when (and (not (boundp (intern (car groups) hashtb)))
+                         (not (equal (car groups) "poster")))
                 (push (car groups) errors))
               (pop groups))
             (if (not errors)
@@ -1559,9 +1565,10 @@ the user from the mailer."
           (while (and headers (not error))
             (when (setq header (mail-fetch-field (car headers)))
               (if (or
-                   (not (string-match
-                         "\\`\\([-.a-zA-Z0-9]+\\)?\\(,[-.a-zA-Z0-9]+\\)*\\'"
-                         header))
+                   (not 
+                    (string-match
+                     "\\`\\([-+_&.a-zA-Z0-9]+\\)?\\(,[-.a-zA-Z0-9]+\\)*\\'"
+                     header))
                    (memq 
                     nil (mapcar 
                          (lambda (g)
@@ -2126,6 +2133,36 @@ Headers already prepared in the buffer are not modified."
 ;;; Setting up a message buffer
 ;;;
 
+(defun message-fill-address (header value)
+  (save-restriction
+    (narrow-to-region (point) (point))
+    (insert (capitalize (symbol-name header))
+           ": "
+           (if (consp value) (car value) value)
+           "\n")
+    (narrow-to-region (point-min) (1- (point-max)))
+    (let (quoted last)
+      (goto-char (point-min))
+      (while (not (eobp))
+       (skip-chars-forward "^,\"" (point-max))
+       (if (or (= (following-char) ?,)
+               (eobp))
+           (when (not quoted)
+             (if (and (> (current-column) 78)
+                      last)
+                 (progn
+                   (save-excursion
+                     (goto-char last)
+                     (insert "\n\t"))
+                   (setq last (1+ (point))))
+               (setq last (1+ (point)))))
+         (setq quoted (not quoted)))
+       (unless (eobp)
+         (forward-char 1))))
+    (goto-char (point-max))
+    (widen)
+    (forward-line 1)))
+
 (defun message-fill-header (header value)
   (let ((begin (point))
        (fill-column 78)
@@ -2217,6 +2254,11 @@ Headers already prepared in the buffer are not modified."
          (nconc message-buffer-list (list (current-buffer))))))
 
 (defun message-setup (headers &optional replybuffer actions)
+  (when (and (boundp 'mc-modes-alist)
+            (not (assq 'message-mode mc-modes-alist)))
+    (push '(message-mode (encrypt . mc-encrypt-message)
+                        (sign . mc-sign-message))
+         mc-modes-alist))
   (when actions
     (setq message-send-actions actions))
   (setq message-reply-buffer replybuffer)
@@ -2257,6 +2299,7 @@ Headers already prepared in the buffer are not modified."
        (delq 'Lines
             (delq 'Subject
                   (copy-sequence message-required-mail-headers))))))
+  (run-hooks 'message-signature-setup-hook)
   (message-insert-signature)
   (message-set-auto-save-file-name)
   (save-restriction
@@ -2889,6 +2932,8 @@ The following arguments may contain lists of values."
        (list
         (list list))))
 
+(run-hooks 'message-load-hook)
+
 (provide 'message)
 
 ;;; message.el ends here