aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Stallman2019-02-24 10:45:34 -0800
committerPaul Eggert2019-02-24 10:46:14 -0800
commit13e6275e58c3dc84fbb65bc9d05eb875e3096f5f (patch)
tree3c16a8169bf2de80aa13b87a0db099d9b4504216
parent5a513470276f1f48ee44f4409a323ba526c18f4e (diff)
downloademacs-13e6275e58c3dc84fbb65bc9d05eb875e3096f5f.tar.gz
emacs-13e6275e58c3dc84fbb65bc9d05eb875e3096f5f.zip
fix rmail armor decryption problems
* lisp/mail/rmail.el (rmail-epa-decrypt): Don't decrypt an armor that was copied into the message from a message it is a reply to. (rmail-epa-decrypt-1): Catch and ignore errors in epa-decrypt-region. Make armor-start and armor-end markers.
-rw-r--r--lisp/mail/rmail.el33
1 files changed, 21 insertions, 12 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 36821e83e0d..7f7f0e967d0 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -4544,6 +4544,9 @@ Argument MIME is non-nil if this is a mime message."
4544 4544
4545 (unless armor-end 4545 (unless armor-end
4546 (error "Encryption armor beginning has no matching end")) 4546 (error "Encryption armor beginning has no matching end"))
4547 (setq armor-start (move-marker (make-marker) armor-start))
4548 (setq armor-end (move-marker (make-marker) armor-end))
4549
4547 (goto-char armor-start) 4550 (goto-char armor-start)
4548 4551
4549 ;; Because epa--find-coding-system-for-mime-charset not autoloaded. 4552 ;; Because epa--find-coding-system-for-mime-charset not autoloaded.
@@ -4576,15 +4579,16 @@ Argument MIME is non-nil if this is a mime message."
4576 (mail-unquote-printable-region armor-start 4579 (mail-unquote-printable-region armor-start
4577 (- (point-max) after-end)))) 4580 (- (point-max) after-end))))
4578 4581
4579 ;; Decrypt it, maybe in place, maybe making new buffer. 4582 (condition-case nil
4580 (epa-decrypt-region 4583 (epa-decrypt-region
4581 armor-start (- (point-max) after-end) 4584 armor-start (- (point-max) after-end)
4582 ;; Call back this function to prepare the output. 4585 ;; Call back this function to prepare the output.
4583 (lambda () 4586 (lambda ()
4584 (let ((inhibit-read-only t)) 4587 (let ((inhibit-read-only t))
4585 (delete-region armor-start (- (point-max) after-end)) 4588 (delete-region armor-start (- (point-max) after-end))
4586 (goto-char armor-start) 4589 (goto-char armor-start)
4587 (current-buffer)))) 4590 (current-buffer))))
4591 (error nil))
4588 4592
4589 (list armor-start (- (point-max) after-end) mime 4593 (list armor-start (- (point-max) after-end) mime
4590 armor-end-regexp 4594 armor-end-regexp
@@ -4620,9 +4624,14 @@ Argument MIME is non-nil if this is a mime message."
4620 (goto-char (point-min)) 4624 (goto-char (point-min))
4621 (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t) 4625 (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
4622 (let ((coding-system-for-read coding-system-for-read) 4626 (let ((coding-system-for-read coding-system-for-read)
4623 (case-fold-search t)) 4627 (case-fold-search t)
4624 4628 (armor-start (match-beginning 0)))
4625 (push (rmail-epa-decrypt-1 mime) decrypts))) 4629 ;; Don't decrypt an armor that was copied into
4630 ;; the message from a message it is a reply to.
4631 (or (equal (buffer-substring (line-beginning-position)
4632 armor-start)
4633 "> ")
4634 (push (rmail-epa-decrypt-1 mime) decrypts))))
4626 4635
4627 (when (and decrypts (eq major-mode 'rmail-mode)) 4636 (when (and decrypts (eq major-mode 'rmail-mode))
4628 (rmail-add-label "decrypt")) 4637 (rmail-add-label "decrypt"))