diff options
| author | Richard Stallman | 2023-01-25 16:35:37 -0500 |
|---|---|---|
| committer | Richard Stallman | 2023-01-25 16:35:37 -0500 |
| commit | 3365e413bd9cb482849cf48e4f6c366a61326569 (patch) | |
| tree | 2f9127e5a2d4d06294b49e97b6808aa4d4192dfd | |
| parent | 8b87d095acfb23b527f955873a59dd9c13ffc9b4 (diff) | |
| download | emacs-3365e413bd9cb482849cf48e4f6c366a61326569.tar.gz emacs-3365e413bd9cb482849cf48e4f6c366a61326569.zip | |
When base64-decoding part of decrypted text, save the decoding
permanently if we save the decryption permanently.
(rmail-epa-decode): Take arguments BEG and BACK-FROM-END to designate region.
(rmail-epa-decrypt-1): Call rmail-epa-decode from here, when decrypting one
encrypted passage.
(rmail-epa-decrypt): Not from here.
| -rw-r--r-- | lisp/mail/rmail.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 659649b5d42..c56f4ce62dc 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -4580,6 +4580,9 @@ Argument MIME is non-nil if this is a mime message." | |||
| 4580 | (current-buffer)))) | 4580 | (current-buffer)))) |
| 4581 | (error nil)) | 4581 | (error nil)) |
| 4582 | 4582 | ||
| 4583 | ;; Decode any base64-encoded material in what we just decrypted. | ||
| 4584 | (rmail-epa-decode armor-start after-end) | ||
| 4585 | |||
| 4583 | (list armor-start (- (point-max) after-end) mime | 4586 | (list armor-start (- (point-max) after-end) mime |
| 4584 | armor-end-regexp | 4587 | armor-end-regexp |
| 4585 | (buffer-substring armor-start (- (point-max) after-end))))) | 4588 | (buffer-substring armor-start (- (point-max) after-end))))) |
| @@ -4622,9 +4625,6 @@ Argument MIME is non-nil if this is a mime message." | |||
| 4622 | "> ") | 4625 | "> ") |
| 4623 | (push (rmail-epa-decrypt-1 mime) decrypts)))) | 4626 | (push (rmail-epa-decrypt-1 mime) decrypts)))) |
| 4624 | 4627 | ||
| 4625 | ;; Decode any base64-encoded mime sections. | ||
| 4626 | (rmail-epa-decode) | ||
| 4627 | |||
| 4628 | (when (and decrypts (rmail-buffers-swapped-p)) | 4628 | (when (and decrypts (rmail-buffers-swapped-p)) |
| 4629 | (when (y-or-n-p "Replace the original message? ") | 4629 | (when (y-or-n-p "Replace the original message? ") |
| 4630 | (when (eq major-mode 'rmail-mode) | 4630 | (when (eq major-mode 'rmail-mode) |
| @@ -4689,12 +4689,14 @@ Argument MIME is non-nil if this is a mime message." | |||
| 4689 | (unless decrypts | 4689 | (unless decrypts |
| 4690 | (error "Nothing to decrypt"))))) | 4690 | (error "Nothing to decrypt"))))) |
| 4691 | 4691 | ||
| 4692 | ;; Decode all base64-encoded mime sections, so that this change | 4692 | ;; Decode all base64-encoded mime sections from BEG to (Z - BACK-FROM-END), |
| 4693 | ;; is made in the Rmail file, not just in the viewing buffer. | 4693 | ;; so that we save the decoding permanently in the Rmail buffer |
| 4694 | (defun rmail-epa-decode () | 4694 | ;; if we permanently save the decryption. |
| 4695 | (defun rmail-epa-decode (beg back-from-end) | ||
| 4695 | (save-excursion | 4696 | (save-excursion |
| 4696 | (goto-char (point-min)) | 4697 | (goto-char beg) |
| 4697 | (while (re-search-forward "--------------[0-9a-zA-Z]+\n" nil t) | 4698 | (while (re-search-forward "--------------[0-9a-zA-Z]+\n" |
| 4699 | (- (point-max) back-from-end) t) | ||
| 4698 | ;; The ending delimiter is a start delimiter if another section follows. | 4700 | ;; The ending delimiter is a start delimiter if another section follows. |
| 4699 | ;; Otherwise it is an end delimiter, with -- affixed. | 4701 | ;; Otherwise it is an end delimiter, with -- affixed. |
| 4700 | (let ((delim (concat (substring (match-string 0) 0 -1) "\\(\\|--\\)\n"))) | 4702 | (let ((delim (concat (substring (match-string 0) 0 -1) "\\(\\|--\\)\n"))) |