emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105870: mml.el (mml-inhibit-compute-


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105870: mml.el (mml-inhibit-compute-boundary): New internal variable.
Date: Thu, 22 Sep 2011 04:43:36 +0000
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105870
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Thu 2011-09-22 04:43:36 +0000
message:
  mml.el (mml-inhibit-compute-boundary): New internal variable.
   (mml-compute-boundary): Don't check collision if it is non-nil.
   (mml-compute-boundary-1): Use mml-generate-mime-1 to encode part before 
checking collision.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/mml.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2011-09-21 22:34:54 +0000
+++ b/lisp/gnus/ChangeLog       2011-09-22 04:43:36 +0000
@@ -1,3 +1,10 @@
+2011-09-22  Katsumi Yamaoka  <address@hidden>
+
+       * mml.el (mml-inhibit-compute-boundary): New internal variable.
+       (mml-compute-boundary): Don't check collision if it is non-nil.
+       (mml-compute-boundary-1): Use mml-generate-mime-1 to encode part
+       before checking collision.
+
 2011-09-21  Lars Magne Ingebrigtsen  <address@hidden>
 
        * message.el (message-indent-citation): Really make sure there's a

=== modified file 'lisp/gnus/mml.el'
--- a/lisp/gnus/mml.el  2011-09-10 08:26:12 +0000
+++ b/lisp/gnus/mml.el  2011-09-22 04:43:36 +0000
@@ -461,6 +461,7 @@
 (defvar mml-boundary nil)
 (defvar mml-base-boundary "-=-=")
 (defvar mml-multipart-number 0)
+(defvar mml-inhibit-compute-boundary nil)
 
 (defun mml-generate-mime ()
   "Generate a MIME message based on the current MML document."
@@ -710,34 +711,30 @@
   "Return a unique boundary that does not exist in CONT."
   (let ((mml-boundary (funcall mml-boundary-function
                               (incf mml-multipart-number))))
-    ;; This function tries again and again until it has found
-    ;; a unique boundary.
-    (while (not (catch 'not-unique
-                 (mml-compute-boundary-1 cont))))
+    (unless mml-inhibit-compute-boundary
+      ;; This function tries again and again until it has found
+      ;; a unique boundary.
+      (while (not (catch 'not-unique
+                   (mml-compute-boundary-1 cont)))))
     mml-boundary))
 
 (defun mml-compute-boundary-1 (cont)
-  (let (filename)
-    (cond
-     ((member (car cont) '(part mml))
-      (with-temp-buffer
-       (cond
-        ((cdr (assq 'buffer cont))
-         (insert-buffer-substring (cdr (assq 'buffer cont))))
-        ((and (setq filename (cdr (assq 'filename cont)))
-              (not (equal (cdr (assq 'nofile cont)) "yes")))
-         (mm-insert-file-contents filename nil nil nil nil t))
-        (t
-         (insert (cdr (assq 'contents cont)))))
-       (goto-char (point-min))
-       (when (re-search-forward (concat "^--" (regexp-quote mml-boundary))
-                                nil t)
-         (setq mml-boundary (funcall mml-boundary-function
-                                     (incf mml-multipart-number)))
-         (throw 'not-unique nil))))
-     ((eq (car cont) 'multipart)
-      (mapc 'mml-compute-boundary-1 (cddr cont))))
-    t))
+  (cond
+   ((member (car cont) '(part mml))
+    (mm-with-multibyte-buffer
+      (let ((mml-inhibit-compute-boundary t)
+           (mml-multipart-number 0)
+           mml-sign-alist mml-encrypt-alist)
+       (mml-generate-mime-1 cont))
+      (goto-char (point-min))
+      (when (re-search-forward (concat "^--" (regexp-quote mml-boundary))
+                              nil t)
+       (setq mml-boundary (funcall mml-boundary-function
+                                   (incf mml-multipart-number)))
+       (throw 'not-unique nil))))
+   ((eq (car cont) 'multipart)
+    (mapc 'mml-compute-boundary-1 (cddr cont))))
+  t)
 
 (defun mml-make-boundary (number)
   (concat (make-string (% number 60) ?=)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]