Commit f65bd833 authored by Katsumi Yamaoka's avatar Katsumi Yamaoka
Browse files

Gnus: Share the value of the buffer-local `message-options' variable between a...

Gnus: Share the value of the buffer-local `message-options' variable between a draft buffer and temprary working buffers.
parent 1bbe96b2
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.
......
......@@ -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)
......
......@@ -4507,7 +4507,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...")
......@@ -4546,9 +4547,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
......@@ -4630,9 +4633,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)
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment