* mm-util.el (mm-auto-save-coding-system): Default to iso-2022-7bit.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 29 Oct 2002 10:02:02 +0000 (10:02 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 29 Oct 2002 10:02:02 +0000 (10:02 +0000)
* nndraft.el (nndraft-request-article): Decode an article using the
 coding-system emacs-mule if it seems to have been saved using emacs-mule.
(nndraft-request-replace-article): Use message-draft-coding-system instead
 of mm-auto-save-coding-system for the draft or delayed group.

lisp/ChangeLog
lisp/mm-util.el
lisp/nndraft.el

index 635703e..cfe7e1c 100644 (file)
@@ -1,8 +1,20 @@
+2002-10-29  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-util.el (mm-auto-save-coding-system): Default to
+       iso-2022-7bit.
+
+       * nndraft.el (nndraft-request-article): Decode an article using
+       the coding-system emacs-mule if it seems to have been saved using
+       emacs-mule.
+       (nndraft-request-replace-article): Use message-draft-coding-system
+       instead of mm-auto-save-coding-system for the draft or delayed
+       group.
+
 2002-10-28  Josh  <huber@alum.wpi.edu>
 
        * mml.el (mml-mode-map): Fixed keybindings for mml-secure-*
        functions.
-       
+
 2002-10-28  Katsumi Yamaoka  <yamaoka@jpl.org>
        From mah@everybody.org (Mark A. Hershberger).
 
index 174fb9e..35f249c 100644 (file)
   "Text coding system for write.")
 
 (defvar mm-auto-save-coding-system
-  (cond
-   ((mm-coding-system-p 'emacs-mule)
-    (if (memq system-type '(windows-nt ms-dos ms-windows))
-       (if (mm-coding-system-p 'emacs-mule-dos)
-           'emacs-mule-dos mm-binary-coding-system)
-      'emacs-mule))
-   ((mm-coding-system-p 'escape-quoted) 'escape-quoted)
-   (t mm-binary-coding-system))
-  "Coding system of auto save file.")
+  (if (mm-coding-system-p 'iso-2022-7bit)
+      'iso-2022-7bit)
+  "Coding system of auto save file.
+Note that the default value for this variable was emacs-mule for Emacs
+or escape-quoted for XEmacs-MULE in the past.")
 
 (defvar mm-universal-coding-system mm-auto-save-coding-system
   "The universal coding system.")
index c655d9c..2c03bf2 100644 (file)
     (let* ((file (nndraft-article-filename id))
           (auto (nndraft-auto-save-file-name file))
           (newest (if (file-newer-than-file-p file auto) file auto))
-          (nntp-server-buffer (or buffer nntp-server-buffer)))
+          (nntp-server-buffer (or buffer nntp-server-buffer))
+          ;; The default value for `message-draft-coding-system' was
+          ;; `emacs-mule' for Emacs in the past, and the existing draft
+          ;; files may have been saved using that coding-system.
+          (maybe-emacs-mule-p (and (not (featurep 'xemacs))
+                                   (eq message-draft-coding-system
+                                       ;; The present default value.
+                                       'iso-2022-7bit)
+                                   (mm-coding-system-p 'emacs-mule))))
       (when (and (file-exists-p newest)
                 (let ((nnmail-file-coding-system
                        (if (file-newer-than-file-p file auto)
                            (if (member group '("drafts" "delayed"))
-                               message-draft-coding-system
+                               (if maybe-emacs-mule-p
+                                   mm-text-coding-system
+                                 message-draft-coding-system)
                              mm-text-coding-system)
                          mm-auto-save-coding-system)))
                   (nnmail-find-file newest)))
        (save-excursion
          (set-buffer nntp-server-buffer)
+         (when maybe-emacs-mule-p
+           (goto-char (point-min))
+           (if (re-search-forward "[^\000-\177]" nil t)
+               ;; Consider the file has been saved using `emacs-mule'.
+               (mm-decode-coding-region (point-min) (point-max)
+                                        'emacs-mule)
+             (mm-decode-coding-region (point-min) (point-max)
+                                      message-draft-coding-system)))
          (goto-char (point-min))
          ;; If there's a mail header separator in this file,
          ;; we remove it.
 (deffoo nndraft-request-replace-article (article group buffer)
   (nndraft-possibly-change-group group)
   (let ((nnmail-file-coding-system
-        (if (equal group "drafts")
-            mm-auto-save-coding-system
+        (if (member group '("drafts" "delayed"))
+            message-draft-coding-system
           mm-text-coding-system)))
     (nnoo-parent-function 'nndraft 'nnmh-request-replace-article
                          (list article group buffer))))