From: ueno Date: Sun, 31 Dec 2006 11:47:25 +0000 (+0000) Subject: Fixed. X-Git-Tag: epg-0_0_10~39 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=61a392450fe16e33fd2f6a96cb8941a39dc73ca6;p=elisp%2Fepg.git Fixed. --- diff --git a/epa.el b/epa.el index 40cc0ab..21a470d 100644 --- a/epa.el +++ b/epa.el @@ -979,20 +979,26 @@ If no one is selected, default secret key is used. " (epa-sign-region start end signers mode)) ;;;###autoload -(defun epa-encrypt-region (start end recipients) +(defun epa-encrypt-region (start end recipients sign signers) "Encrypt the current region between START and END for RECIPIENTS. Don't use this command in Lisp programs!" (interactive - (progn + (let ((sign (if current-prefix-arg (y-or-n-p "Sign? "))) + (context (epg-make-context epa-protocol)) + sign) (setq epa-last-coding-system-specified (or coding-system-for-write (epa--select-safe-coding-system (region-beginning) (region-end)))) (list (region-beginning) (region-end) - (epa-select-keys (epg-make-context epa-protocol) + (epa-select-keys context "Select recipients for encryption. -If no one is selected, symmetric encryption will be performed. ")))) +If no one is selected, symmetric encryption will be performed. ") + sign + (if sign + (epa-select-keys context + "Select keys for signing. "))))) (save-excursion (let ((context (epg-make-context epa-protocol)) cipher) @@ -1000,6 +1006,8 @@ If no one is selected, symmetric encryption will be performed. ")))) (epg-context-set-armor context t) ;;(epg-context-set-textmode context epa-textmode) (epg-context-set-textmode context t) + (if sign + (epg-context-set-signers context signers)) (epg-context-set-passphrase-callback context #'epa-passphrase-callback-function) (epg-context-set-progress-callback context @@ -1026,13 +1034,16 @@ If no one is selected, symmetric encryption will be performed. ")))) 'end-open t))))) ;;;###autoload -(defun epa-encrypt (start end recipients) +(defun epa-encrypt (start end recipients sign signers) "Encrypt the current buffer. Don't use this command in Lisp programs!" (interactive (save-excursion - (let (recipients) + (let* ((verbose current-prefix-arg) + (sign (if verbose (y-or-n-p "Sign? "))) + (context (epg-make-context epa-protocol)) + recipients) (goto-char (point-min)) (when (epa--mail-mode-p) (save-restriction @@ -1057,9 +1068,9 @@ Don't use this command in Lisp programs!" (or coding-system-for-write (epa--select-safe-coding-system (point) (point-max)))) (list (point) (point-max) - (if current-prefix-arg + (if verbose (epa-select-keys - (epg-make-context epa-protocol) + context "Select recipients for encryption. If no one is selected, symmetric encryption will be performed. " recipients) @@ -1071,8 +1082,12 @@ If no one is selected, symmetric encryption will be performed. " (epg-list-keys (epg-make-context epa-protocol) (concat "<" recipient ">"))) - recipients))))))))) - (epa-encrypt-region start end recipients)) + recipients))))) + sign + (if sign + (epa-select-keys context + "Select keys for signing. ")))))) + (epa-encrypt-region start end recipients sign signers)) ;;;###autoload (defun epa-delete-keys (keys &optional allow-secret)