From f65bd83340979074157d53c8b162340ae9954fb4 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Thu, 1 Dec 2011 04:55:39 +0000 Subject: [PATCH] Gnus: Share the value of the buffer-local `message-options' variable between a draft buffer and temprary working buffers. --- lisp/gnus/ChangeLog | 8 ++++++++ lisp/gnus/gnus-msg.el | 5 ++++- lisp/gnus/message.el | 9 +++++++-- lisp/gnus/mml.el | 21 +++++++++++++-------- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index f767ee4407b..b517c81b2b9 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,11 @@ +2011-12-01 Katsumi Yamaoka + + * 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 * message.el (message-pop-to-buffer): Revert 2011-09-11 change. diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index e6a06a0500d..e06d475ed6c 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -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) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index eea50de4cec..ee9d4992158 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -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) diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 8aa5fbff6b8..867c3be4b60 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -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 -- 2.39.2