From 2123b963be9efa50ee3542355e08a0a46a799b1e Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 31 Dec 2006 02:42:32 +0000 Subject: [PATCH] Save excursion. --- epa.el | 78 +++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/epa.el b/epa.el index 39ad100..f999ace 100644 --- a/epa.el +++ b/epa.el @@ -911,7 +911,7 @@ If no one is selected, default secret key is used. " Don't use this command in Lisp programs!" (interactive - (progn + (save-excursion (goto-char (point-min)) (if (and (or (eq major-mode 'mail-mode) (eq (derived-mode-class major-mode) 'mail-mode)) @@ -982,45 +982,47 @@ If no one is selected, symmetric encryption will be performed. ")))) Don't use this command in Lisp programs!" (interactive - (let (recipients) - (goto-char (point-min)) - (when (or (eq major-mode 'mail-mode) - (eq (derived-mode-class major-mode) 'mail-mode)) - (save-restriction - (narrow-to-region (point) - (progn - (search-forward mail-header-separator nil 0) - (match-beginning 0))) - (setq recipients - (mail-strip-quoted-names - (mapconcat #'identity - (nconc (mail-fetch-field "to" nil nil t) - (mail-fetch-field "cc" nil nil t) - (mail-fetch-field "bcc" nil nil t)) - ",")))) - (if recipients - (setq recipients (delete "" (split-string recipients "[ \t\n]+")))) + (save-excursion + (let (recipients) (goto-char (point-min)) - (if (search-forward mail-header-separator nil t) - (forward-line))) - (setq epa-last-coding-system-specified - (or coding-system-for-write - (epa--select-safe-coding-system (point) (point-max)))) - (list (point) (point-max) - (if current-prefix-arg - (epa-select-keys - (epg-make-context epa-protocol) - "Select recipients for encryption. + (when (or (eq major-mode 'mail-mode) + (eq (derived-mode-class major-mode) 'mail-mode)) + (save-restriction + (narrow-to-region (point) + (progn + (search-forward mail-header-separator nil 0) + (match-beginning 0))) + (setq recipients + (mail-strip-quoted-names + (mapconcat #'identity + (nconc (mail-fetch-field "to" nil nil t) + (mail-fetch-field "cc" nil nil t) + (mail-fetch-field "bcc" nil nil t)) + ",")))) + (if recipients + (setq recipients (delete "" (split-string recipients "[ \t\n]+")))) + (goto-char (point-min)) + (if (search-forward mail-header-separator nil t) + (forward-line))) + (setq epa-last-coding-system-specified + (or coding-system-for-write + (epa--select-safe-coding-system (point) (point-max)))) + (list (point) (point-max) + (if current-prefix-arg + (epa-select-keys + (epg-make-context epa-protocol) + "Select recipients for encryption. If no one is selected, symmetric encryption will be performed. " - recipients) - (if recipients - (delq nil - (apply #'nconc - (mapcar - (lambda (recipient) - (epg-list-keys (epg-make-context epa-protocol) - (concat "<" recipient ">"))) - recipients)))))))) + recipients) + (if recipients + (delq nil + (apply #'nconc + (mapcar + (lambda (recipient) + (epg-list-keys + (epg-make-context epa-protocol) + (concat "<" recipient ">"))) + recipients))))))))) (epa-encrypt-region start end recipients)) ;;;###autoload -- 1.7.10.4