Importing Pterodactyl Gnus v0.68.
[elisp/gnus.git-] / lisp / mml.el
index 5184ace..6a52d78 100644 (file)
              (eq charset current)))
         ;; The initial charset was ascii.
         ((eq current 'ascii)
-         (setq current charset))
+         (setq current charset
+               space nil
+               newline nil
+               paragraph nil))
         ;; We have a change in charsets.
         (t
          (push (append
       (buffer-substring-no-properties beg (goto-char (point-max))))))
 
 (defvar mml-boundary nil)
-(defvar mml-base-boundary "=-=-=")
+(defvar mml-base-boundary "-=-=")
 (defvar mml-multipart-number 0)
 
 (defun mml-generate-mime ()
            (setq coded (buffer-string)))
        (mm-with-unibyte-buffer
          (if (setq filename (cdr (assq 'filename cont)))
-             (insert-file-contents filename)
+             (insert-file-contents-literally filename)
            (insert (cdr (assq 'contents cont))))
          (setq encoding (mm-encode-buffer type)
                coded (buffer-string))))
                     cont '(name access-type expiration size permission)))
              (not (equal type "text/plain")))
       (when (consp charset)
-       (debug)
        (error
-        "Can't encode a part with several charsets.  Insert a <#part>."))
+        "Can't encode a part with several charsets."))
       (insert "Content-Type: " type)
       (when charset
        (insert "; " (mail-header-encode-parameter
     (unless (eq encoding '7bit)
       (insert (format "Content-Transfer-Encoding: %s\n" encoding)))
     (when (setq description (cdr (assq 'description cont)))
-      (insert "Content-Description: " description "\n"))))
+      (insert "Content-Description: "
+             (mail-encode-encoded-word-string description) "\n"))))
 
 (defun mml-parameter-string (cont types)
   (let ((string "")
            (substring path (1+ (match-end 2))))
     path))
 
+(defun mml-quote-region (beg end)
+  "Quote the MML tags in the region."
+  (interactive "r")
+  (save-excursion
+    (goto-char beg)
+    ;; Quote parts.
+    (while (re-search-forward
+           "<#/?!*\\(multipart\\|part\\|external\\)" end t)
+      (goto-char (match-beginning 1))
+      (insert "!"))))
+
 (provide 'mml)
 
 ;;; mml.el ends here