From: ueno Date: Sun, 31 Dec 2006 02:42:32 +0000 (+0000) Subject: Save excursion. X-Git-Tag: epg-0_0_10~52 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=2123b963be9efa50ee3542355e08a0a46a799b1e;p=elisp%2Fepg.git Save excursion. --- 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