aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/gnus/gnus-msg.el8
-rw-r--r--lisp/gnus/message.el23
2 files changed, 28 insertions, 3 deletions
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index 25efb8afda3..10793455a52 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1587,6 +1587,7 @@ this is a reply."
1587 (message-narrow-to-headers) 1587 (message-narrow-to-headers)
1588 (let ((gcc (or gcc (mail-fetch-field "gcc" nil t))) 1588 (let ((gcc (or gcc (mail-fetch-field "gcc" nil t)))
1589 (cur (current-buffer)) 1589 (cur (current-buffer))
1590 (encoded-cache message-encoded-mail-cache)
1590 groups group method group-art options 1591 groups group method group-art options
1591 mml-externalize-attachments) 1592 mml-externalize-attachments)
1592 (when gcc 1593 (when gcc
@@ -1614,7 +1615,12 @@ this is a reply."
1614 (setq message-options (with-current-buffer cur message-options)) 1615 (setq message-options (with-current-buffer cur message-options))
1615 (insert-buffer-substring cur) 1616 (insert-buffer-substring cur)
1616 (run-hooks 'gnus-gcc-pre-body-encode-hook) 1617 (run-hooks 'gnus-gcc-pre-body-encode-hook)
1617 (message-encode-message-body) 1618 ;; Avoid re-doing things like GPG-encoding secret parts.
1619 (if (not encoded-cache)
1620 (message-encode-message-body)
1621 (erase-buffer)
1622 (insert encoded-cache))
1623 (message-remove-header "gcc")
1618 (run-hooks 'gnus-gcc-post-body-encode-hook) 1624 (run-hooks 'gnus-gcc-post-body-encode-hook)
1619 (save-restriction 1625 (save-restriction
1620 (message-narrow-to-headers) 1626 (message-narrow-to-headers)
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 58b25f91440..c211bcc2654 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1891,6 +1891,9 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'."
1891(defvar message-bogus-system-names "\\`localhost\\.\\|\\.local\\'" 1891(defvar message-bogus-system-names "\\`localhost\\.\\|\\.local\\'"
1892 "The regexp of bogus system names.") 1892 "The regexp of bogus system names.")
1893 1893
1894(defvar message-encoded-mail-cache nil
1895 "After sending a message, the encoded version is cached in this variable.")
1896
1894(autoload 'gnus-alive-p "gnus-util") 1897(autoload 'gnus-alive-p "gnus-util")
1895(autoload 'gnus-delay-article "gnus-delay") 1898(autoload 'gnus-delay-article "gnus-delay")
1896(autoload 'gnus-extract-address-components "gnus-util") 1899(autoload 'gnus-extract-address-components "gnus-util")
@@ -2974,7 +2977,8 @@ Like `text-mode', but with these additional commands:
2974 ;; excluding citations and other artifacts. 2977 ;; excluding citations and other artifacts.
2975 ;; 2978 ;;
2976 (set (make-local-variable 'syntax-propertize-function) 'message--syntax-propertize) 2979 (set (make-local-variable 'syntax-propertize-function) 'message--syntax-propertize)
2977 (set (make-local-variable 'parse-sexp-ignore-comments) t)) 2980 (set (make-local-variable 'parse-sexp-ignore-comments) t)
2981 (setq-local message-encoded-mail-cache nil))
2978 2982
2979(defun message-setup-fill-variables () 2983(defun message-setup-fill-variables ()
2980 "Setup message fill variables." 2984 "Setup message fill variables."
@@ -4598,6 +4602,7 @@ If you always want Gnus to send messages in one piece, set
4598 (mml-buffer-substring-no-properties-except-some 4602 (mml-buffer-substring-no-properties-except-some
4599 (point-min) (point-max)))) 4603 (point-min) (point-max))))
4600 (message-encode-message-body) 4604 (message-encode-message-body)
4605 (message--cache-encoded mailbuf)
4601 (save-restriction 4606 (save-restriction
4602 (message-narrow-to-headers) 4607 (message-narrow-to-headers)
4603 ;; We (re)generate the Lines header. 4608 ;; We (re)generate the Lines header.
@@ -4653,6 +4658,14 @@ If you always want Gnus to send messages in one piece, set
4653 (setq message-options options) 4658 (setq message-options options)
4654 (push 'mail message-sent-message-via))) 4659 (push 'mail message-sent-message-via)))
4655 4660
4661(defun message--cache-encoded (mailbuf)
4662 ;; Store the encoded buffer data for possible reuse later
4663 ;; when doing Fcc/Gcc handling. This avoids having to do
4664 ;; things like re-GPG-encoding secure parts.
4665 (let ((encoded (buffer-string)))
4666 (with-current-buffer mailbuf
4667 (setq message-encoded-mail-cache encoded))))
4668
4656(defun message--fold-long-headers () 4669(defun message--fold-long-headers ()
4657 "Fold too-long header lines. 4670 "Fold too-long header lines.
4658Each line should be no more than 79 characters long." 4671Each line should be no more than 79 characters long."
@@ -4946,6 +4959,7 @@ Otherwise, generate and save a value for `canlock-password' first."
4946 (mml-buffer-substring-no-properties-except-some 4959 (mml-buffer-substring-no-properties-except-some
4947 (point-min) (point-max)))) 4960 (point-min) (point-max))))
4948 (message-encode-message-body) 4961 (message-encode-message-body)
4962 (message--cache-encoded messbuf)
4949 ;; Remove some headers. 4963 ;; Remove some headers.
4950 (save-restriction 4964 (save-restriction
4951 (message-narrow-to-headers) 4965 (message-narrow-to-headers)
@@ -5408,6 +5422,7 @@ The result is a fixnum."
5408 "Process Fcc headers in the current buffer." 5422 "Process Fcc headers in the current buffer."
5409 (let ((case-fold-search t) 5423 (let ((case-fold-search t)
5410 (buf (current-buffer)) 5424 (buf (current-buffer))
5425 (encoded-cache message-encoded-mail-cache)
5411 (mml-externalize-attachments message-fcc-externalize-attachments) 5426 (mml-externalize-attachments message-fcc-externalize-attachments)
5412 (file (message-field-value "fcc" t)) 5427 (file (message-field-value "fcc" t))
5413 list) 5428 list)
@@ -5415,7 +5430,11 @@ The result is a fixnum."
5415 (with-temp-buffer 5430 (with-temp-buffer
5416 (insert-buffer-substring buf) 5431 (insert-buffer-substring buf)
5417 (message-clone-locals buf) 5432 (message-clone-locals buf)
5418 (message-encode-message-body) 5433 ;; Avoid re-doing things like GPG-encoding secret parts.
5434 (if (not encoded-cache)
5435 (message-encode-message-body)
5436 (erase-buffer)
5437 (insert encoded-cache))
5419 (save-restriction 5438 (save-restriction
5420 (message-narrow-to-headers) 5439 (message-narrow-to-headers)
5421 (while (setq file (message-fetch-field "fcc" t)) 5440 (while (setq file (message-fetch-field "fcc" t))