Share the value of the buffer-local `message-options' variable between a draft buffer...
authorKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 1 Dec 2011 04:55:11 +0000 (04:55 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 1 Dec 2011 04:55:11 +0000 (04:55 +0000)
lisp/ChangeLog
lisp/gnus-msg.el
lisp/message.el
lisp/mml.el

index e4b4423..cc76699 100644 (file)
@@ -1,3 +1,11 @@
+2011-12-01  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-msg.el (gnus-inews-do-gcc):
+       * message.el (message-send-mail):
+       * mml.el (mml-generate-mime): Share the value of the buffer-local
+       `message-options' variable between a draft buffer and temprary working
+       buffers.
+
 2011-11-30  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * message.el (message-pop-to-buffer): Revert 2011-09-11 change.
index e6a06a0..e06d475 100644 (file)
@@ -1549,7 +1549,7 @@ this is a reply."
       (message-narrow-to-headers)
       (let ((gcc (or gcc (mail-fetch-field "gcc" nil t)))
            (cur (current-buffer))
-           groups group method group-art
+           groups group method group-art options
            mml-externalize-attachments)
        (when gcc
          (message-remove-header "gcc")
@@ -1573,6 +1573,7 @@ this is a reply."
                    gnus-gcc-externalize-attachments))
            (save-excursion
              (nnheader-set-temp-buffer " *acc*")
+             (setq message-options (with-current-buffer cur message-options))
              (insert-buffer-substring cur)
              (message-encode-message-body)
              (save-restriction
@@ -1629,6 +1630,8 @@ this is a reply."
                              (boundp 'gnus-inews-mark-gcc-as-read)
                              (symbol-value 'gnus-inews-mark-gcc-as-read))))
                (gnus-group-mark-article-read group (cdr group-art)))
+             (setq options message-options)
+             (with-current-buffer cur (setq message-options options))
              (kill-buffer (current-buffer)))))))))
 
 (defun gnus-inews-insert-gcc (&optional group)
index e0a8f20..3a2e1b9 100644 (file)
@@ -4551,7 +4551,8 @@ This function could be useful in `message-setup-hook'."
                   (boundp 'gnus-group-posting-charset-alist))
              (gnus-setup-posting-charset nil)
            message-posting-charset))
-        (headers message-required-mail-headers))
+        (headers message-required-mail-headers)
+        options)
     (when (and message-generate-hashcash
               (not (eq message-generate-hashcash 'opportunistic)))
       (message "Generating hashcash...")
@@ -4590,9 +4591,11 @@ This function could be useful in `message-setup-hook'."
              (error "Failed to send the message")))))
       ;; Let the user do all of the above.
       (run-hooks 'message-header-hook))
+    (setq options message-options)
     (unwind-protect
        (with-current-buffer tembuf
          (erase-buffer)
+         (setq message-options options)
          ;; Avoid copying text props (except hard newlines).
          (insert (with-current-buffer mailbuf
                    (mml-buffer-substring-no-properties-except-hard-newlines
@@ -4674,9 +4677,11 @@ If you always want Gnus to send messages in one piece, set
                (message "Sending via mail...")
                (funcall (or message-send-mail-real-function
                             message-send-mail-function)))
-           (message-send-mail-partially)))
+           (message-send-mail-partially))
+         (setq options message-options))
       (kill-buffer tembuf))
     (set-buffer mailbuf)
+    (setq message-options options)
     (push 'mail message-sent-message-via)))
 
 (defvar sendmail-program)
index 8aa5fbf..867c3be 100644 (file)
@@ -466,16 +466,21 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
 (defun mml-generate-mime ()
   "Generate a MIME message based on the current MML document."
   (let ((cont (mml-parse))
-       (mml-multipart-number mml-multipart-number))
+       (mml-multipart-number mml-multipart-number)
+       (options message-options))
     (if (not cont)
        nil
-      (mm-with-multibyte-buffer
-       (if (and (consp (car cont))
-                (= (length cont) 1))
-           (mml-generate-mime-1 (car cont))
-         (mml-generate-mime-1 (nconc (list 'multipart '(type . "mixed"))
-                                     cont)))
-       (buffer-string)))))
+      (prog1
+         (mm-with-multibyte-buffer
+           (setq message-options options)
+           (if (and (consp (car cont))
+                    (= (length cont) 1))
+               (mml-generate-mime-1 (car cont))
+             (mml-generate-mime-1 (nconc (list 'multipart '(type . "mixed"))
+                                         cont)))
+           (setq options message-options)
+           (buffer-string))
+       (setq message-options options)))))
 
 (defun mml-generate-mime-1 (cont)
   (let ((mm-use-ultra-safe-encoding