*** empty log message ***
[gnus] / lisp / message.el
index 32d909f..cb578a9 100644 (file)
@@ -879,8 +879,12 @@ The cdr of ech entry is a function for applying the face to a region.")
   "Coding system to encode outgoing mail.")
 
 (defvar message-draft-coding-system 
-  (if (string-match "XEmacs\\|Lucid" emacs-version)
-      'escape-quoted 'emacs-mule)
+  (cond 
+   ((not (fboundp 'coding-system-p)) nil)
+   ((coding-system-p 'emacs-mule) 'emacs-mule)
+   ((coding-system-p 'escape-quoted) 'escape-quoted)
+   ((coding-system-p 'no-conversion) 'no-conversion)
+   (t nil))
   "Coding system to compose mail.")
 
 (defvar message-default-charset 'iso-8859-1
@@ -1317,8 +1321,8 @@ Point is left at the beginning of the narrowed-to region."
   (define-key message-mode-map "\C-c\C-z" 'message-kill-to-signature)
   (define-key message-mode-map "\M-\r" 'message-newline-and-reformat)
 
-  (define-key message-mode-map "\C-c\C-a" 'message-insert-mime-part)
-  (define-key message-mode-map "\C-c\C-m\C-a" 'message-insert-mime-part)
+  (define-key message-mode-map "\C-c\C-a" 'message-mime-attach-file)
+  (define-key message-mode-map "\C-c\C-m\C-a" 'message-mime-attach-file)
   (define-key message-mode-map "\C-c\C-m\C-e" 'message-mime-insert-external)
   (define-key message-mode-map "\C-c\C-m\C-q" 'mml-quote-region)
   
@@ -2011,7 +2015,6 @@ the user from the mailer."
   (let ((inhibit-read-only t))
     (put-text-property (point-min) (point-max) 'read-only nil))
   (message-fix-before-sending)
-  (message-encode-message-body)
   (run-hooks 'message-send-hook)
   (message "Sending...")
   (let ((alist message-send-method-alist)
@@ -2032,7 +2035,8 @@ the user from the mailer."
       (message-do-fcc)
       ;;(when (fboundp 'mail-hist-put-headers-into-history)
       ;; (mail-hist-put-headers-into-history))
-      (run-hooks 'message-sent-hook)
+      (save-excursion
+       (run-hooks 'message-sent-hook))
       (message "Sending...done")
       ;; Mark the buffer as unmodified and delete auto-save.
       (set-buffer-modified-p nil)
@@ -2110,6 +2114,7 @@ the user from the mailer."
       (mail-encode-encoded-word-buffer)
       ;; Let the user do all of the above.
       (run-hooks 'message-header-hook))
+    (message-encode-message-body)
     (unwind-protect
        (save-excursion
          (set-buffer tembuf)
@@ -2283,6 +2288,7 @@ to find out how to use this."
        (mail-encode-encoded-word-buffer)
        ;; Let the user do all of the above.
        (run-hooks 'message-header-hook))
+      (message-encode-message-body)
       (message-cleanup-headers)
       (if (not (message-check-news-syntax))
          nil
@@ -4127,7 +4133,7 @@ regexp varstr."
 ;; I really think this function should be renamed.  It is only useful
 ;; for inserting file attachments.
 
-(defun message-insert-mime-part (file type description)
+(defun message-mime-attach-file (file type description)
   "Attach a file to the outgoing MIME message.
 The file is not inserted or encoded until you send the message with
 `\\[message-send-and-exit]' or `\\[message-send]'.