From e0c24f159ab27027c3445aa6223d3cc992393403 Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 31 Dec 2006 02:10:33 +0000 Subject: [PATCH] * epa.el (epa-import-armor-in-region): New command. (epa-import): New command. --- ChangeLog | 2 ++ epa.el | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3643122..0dcf182 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ (epa-verify): New command. (epa-sign): New command. (epa-encrypt): New command. + (epa-import-armor-in-region): New command. + (epa-import): New command. 2006-12-29 Daiki Ueno diff --git a/epa.el b/epa.el index 2af91fc..6c48380 100644 --- a/epa.el +++ b/epa.el @@ -1074,6 +1074,37 @@ Don't use this command in Lisp programs!" (epg-context-result-for context 'import)))))) ;;;###autoload +(defun epa-import-armor-in-region (start end) + "Import keys in the OpenPGP armor format in the current region +between START and END. + +Don't use this command in Lisp programs!" + (interactive "r") + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char start) + (let (armor-start armor-end) + (while (re-search-forward + "-----BEGIN \\(PGP \\(PUBLIC\\|PRIVATE\\) KEY BLOCK\\)-----$" + nil t) + (setq armor-start (match-beginning 0) + armor-end (re-search-forward + (concat "^-----END " (match-string 1) "-----$") + nil t)) + (unless armor-end + (error "No armor tail")) + (epa-import-keys-region armor-start armor-end)))))) + +;;;###autoload +(defun epa-import () + "Import keys in the OpenPGP armor format in the current buffer. + +Don't use this command in Lisp programs!" + (interactive) + (epa-import-armor-in-region (point-min) (point-max))) + +;;;###autoload (defun epa-export-keys (keys file) "Export selected KEYS to FILE. -- 1.7.10.4