aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olson2008-04-01 05:28:04 +0000
committerMichael Olson2008-04-01 05:28:04 +0000
commit2c6c404a7862666d16c8edac1c186e036ba661f3 (patch)
tree6846dcb8d26f1627d75059ea5995b4ec31357f1d
parentc899d5e37a6dd5ab33bc9c19280715aa02b04643 (diff)
downloademacs-2c6c404a7862666d16c8edac1c186e036ba661f3.tar.gz
emacs-2c6c404a7862666d16c8edac1c186e036ba661f3.zip
minor fixes for EasyPG
Hello, Would someone please apply the attached patch which only contains minor bug/doc fixes for EasyPG? Then I'll post an update of the patch: http://article.gmane.org/gmane.emacs.devel/89452
-rw-r--r--doc/misc/epa.texi7
-rw-r--r--lisp/epa.el93
-rw-r--r--lisp/epg.el2
3 files changed, 74 insertions, 28 deletions
diff --git a/doc/misc/epa.texi b/doc/misc/epa.texi
index de712aa40fd..8063690f7e1 100644
--- a/doc/misc/epa.texi
+++ b/doc/misc/epa.texi
@@ -364,6 +364,13 @@ line on the first line of the text being encrypted.
364@end lisp 364@end lisp
365@end cartouche 365@end cartouche
366 366
367The file name extension of encrypted files can be controlled by
368@var{epa-file-name-regexp}.
369
370@defvar epa-file-name-regexp
371Regexp which matches filenames treated as encrypted.
372@end defvar
373
367Other variables which control the automatic encryption/decryption 374Other variables which control the automatic encryption/decryption
368behavior are below. 375behavior are below.
369 376
diff --git a/lisp/epa.el b/lisp/epa.el
index 21c4e70a9e1..4f2b743d85f 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -543,9 +543,7 @@ NAMES is a list of strings to be matched with keys. If it is nil, all
543the keys are listed. 543the keys are listed.
544If SECRET is non-nil, list secret keys instead of public keys." 544If SECRET is non-nil, list secret keys instead of public keys."
545 (let ((keys (epg-list-keys context names secret))) 545 (let ((keys (epg-list-keys context names secret)))
546 (if (> (length keys) 1) 546 (epa--select-keys prompt keys)))
547 (epa--select-keys prompt keys)
548 keys)))
549 547
550(defun epa--show-key (key) 548(defun epa--show-key (key)
551 (let* ((primary-sub-key (car (epg-key-sub-key-list key))) 549 (let* ((primary-sub-key (car (epg-key-sub-key-list key)))
@@ -812,7 +810,20 @@ If no one is selected, symmetric encryption will be performed. ")))
812(defun epa-decrypt-region (start end) 810(defun epa-decrypt-region (start end)
813 "Decrypt the current region between START and END. 811 "Decrypt the current region between START and END.
814 812
815Don't use this command in Lisp programs!" 813Don't use this command in Lisp programs!
814Since this function operates on regions, it does some tricks such
815as coding-system detection and unibyte/multibyte conversion. If
816you are sure how the data in the region should be treated, you
817should consider using the string based counterpart
818`epg-decrypt-string', or the file based counterpart
819`epg-decrypt-file' instead.
820
821For example:
822
823\(let ((context (epg-make-context 'OpenPGP)))
824 (decode-coding-string
825 (epg-decrypt-string context (buffer-substring start end))
826 'utf-8))"
816 (interactive "r") 827 (interactive "r")
817 (save-excursion 828 (save-excursion
818 (let ((context (epg-make-context epa-protocol)) 829 (let ((context (epg-make-context epa-protocol))
@@ -859,7 +870,8 @@ Don't use this command in Lisp programs!"
859(defun epa-decrypt-armor-in-region (start end) 870(defun epa-decrypt-armor-in-region (start end)
860 "Decrypt OpenPGP armors in the current region between START and END. 871 "Decrypt OpenPGP armors in the current region between START and END.
861 872
862Don't use this command in Lisp programs!" 873Don't use this command in Lisp programs!
874See the reason described in the `epa-decrypt-region' documentation."
863 (interactive "r") 875 (interactive "r")
864 (save-excursion 876 (save-excursion
865 (save-restriction 877 (save-restriction
@@ -885,7 +897,20 @@ Don't use this command in Lisp programs!"
885(defun epa-verify-region (start end) 897(defun epa-verify-region (start end)
886 "Verify the current region between START and END. 898 "Verify the current region between START and END.
887 899
888Don't use this command in Lisp programs!" 900Don't use this command in Lisp programs!
901Since this function operates on regions, it does some tricks such
902as coding-system detection and unibyte/multibyte conversion. If
903you are sure how the data in the region should be treated, you
904should consider using the string based counterpart
905`epg-verify-string', or the file based counterpart
906`epg-verify-file' instead.
907
908For example:
909
910\(let ((context (epg-make-context 'OpenPGP)))
911 (decode-coding-string
912 (epg-verify-string context (buffer-substring start end))
913 'utf-8))"
889 (interactive "r") 914 (interactive "r")
890 (let ((context (epg-make-context epa-protocol)) 915 (let ((context (epg-make-context epa-protocol))
891 plain) 916 plain)
@@ -924,7 +949,8 @@ Don't use this command in Lisp programs!"
924 "Verify OpenPGP cleartext signed messages in the current region 949 "Verify OpenPGP cleartext signed messages in the current region
925between START and END. 950between START and END.
926 951
927Don't use this command in Lisp programs!" 952Don't use this command in Lisp programs!
953See the reason described in the `epa-verify-region' documentation."
928 (interactive "r") 954 (interactive "r")
929 (save-excursion 955 (save-excursion
930 (save-restriction 956 (save-restriction
@@ -954,7 +980,19 @@ Don't use this command in Lisp programs!"
954(defun epa-sign-region (start end signers mode) 980(defun epa-sign-region (start end signers mode)
955 "Sign the current region between START and END by SIGNERS keys selected. 981 "Sign the current region between START and END by SIGNERS keys selected.
956 982
957Don't use this command in Lisp programs!" 983Don't use this command in Lisp programs!
984Since this function operates on regions, it does some tricks such
985as coding-system detection and unibyte/multibyte conversion. If
986you are sure how the data should be treated, you should consider
987using the string based counterpart `epg-sign-string', or the file
988based counterpart `epg-sign-file' instead.
989
990For example:
991
992\(let ((context (epg-make-context 'OpenPGP)))
993 (epg-sign-string
994 context
995 (encode-coding-string (buffer-substring start end) 'utf-8)))"
958 (interactive 996 (interactive
959 (let ((verbose current-prefix-arg)) 997 (let ((verbose current-prefix-arg))
960 (setq epa-last-coding-system-specified 998 (setq epa-last-coding-system-specified
@@ -1022,7 +1060,20 @@ Uses the `derived-mode-parent' property of the symbol to trace backwards."
1022(defun epa-encrypt-region (start end recipients sign signers) 1060(defun epa-encrypt-region (start end recipients sign signers)
1023 "Encrypt the current region between START and END for RECIPIENTS. 1061 "Encrypt the current region between START and END for RECIPIENTS.
1024 1062
1025Don't use this command in Lisp programs!" 1063Don't use this command in Lisp programs!
1064Since this function operates on regions, it does some tricks such
1065as coding-system detection and unibyte/multibyte conversion. If
1066you are sure how the data should be treated, you should consider
1067using the string based counterpart `epg-encrypt-string', or the
1068file based counterpart `epg-encrypt-file' instead.
1069
1070For example:
1071
1072\(let ((context (epg-make-context 'OpenPGP)))
1073 (epg-encrypt-string
1074 context
1075 (encode-coding-string (buffer-substring start end) 'utf-8)
1076 nil))"
1026 (interactive 1077 (interactive
1027 (let ((verbose current-prefix-arg) 1078 (let ((verbose current-prefix-arg)
1028 (context (epg-make-context epa-protocol)) 1079 (context (epg-make-context epa-protocol))
@@ -1077,9 +1128,7 @@ If no one is selected, symmetric encryption will be performed. ")
1077 1128
1078;;;###autoload 1129;;;###autoload
1079(defun epa-delete-keys (keys &optional allow-secret) 1130(defun epa-delete-keys (keys &optional allow-secret)
1080 "Delete selected KEYS. 1131 "Delete selected KEYS."
1081
1082Don't use this command in Lisp programs!"
1083 (interactive 1132 (interactive
1084 (let ((keys (epa--marked-keys))) 1133 (let ((keys (epa--marked-keys)))
1085 (unless keys 1134 (unless keys
@@ -1094,9 +1143,7 @@ Don't use this command in Lisp programs!"
1094 1143
1095;;;###autoload 1144;;;###autoload
1096(defun epa-import-keys (file) 1145(defun epa-import-keys (file)
1097 "Import keys from FILE. 1146 "Import keys from FILE."
1098
1099Don't use this command in Lisp programs!"
1100 (interactive "fFile: ") 1147 (interactive "fFile: ")
1101 (setq file (expand-file-name file)) 1148 (setq file (expand-file-name file))
1102 (let ((context (epg-make-context epa-protocol))) 1149 (let ((context (epg-make-context epa-protocol)))
@@ -1115,9 +1162,7 @@ Don't use this command in Lisp programs!"
1115 1162
1116;;;###autoload 1163;;;###autoload
1117(defun epa-import-keys-region (start end) 1164(defun epa-import-keys-region (start end)
1118 "Import keys from the region. 1165 "Import keys from the region."
1119
1120Don't use this command in Lisp programs!"
1121 (interactive "r") 1166 (interactive "r")
1122 (let ((context (epg-make-context epa-protocol))) 1167 (let ((context (epg-make-context epa-protocol)))
1123 (message "Importing...") 1168 (message "Importing...")
@@ -1134,9 +1179,7 @@ Don't use this command in Lisp programs!"
1134;;;###autoload 1179;;;###autoload
1135(defun epa-import-armor-in-region (start end) 1180(defun epa-import-armor-in-region (start end)
1136 "Import keys in the OpenPGP armor format in the current region 1181 "Import keys in the OpenPGP armor format in the current region
1137between START and END. 1182between START and END."
1138
1139Don't use this command in Lisp programs!"
1140 (interactive "r") 1183 (interactive "r")
1141 (save-excursion 1184 (save-excursion
1142 (save-restriction 1185 (save-restriction
@@ -1156,9 +1199,7 @@ Don't use this command in Lisp programs!"
1156 1199
1157;;;###autoload 1200;;;###autoload
1158(defun epa-export-keys (keys file) 1201(defun epa-export-keys (keys file)
1159 "Export selected KEYS to FILE. 1202 "Export selected KEYS to FILE."
1160
1161Don't use this command in Lisp programs!"
1162 (interactive 1203 (interactive
1163 (let ((keys (epa--marked-keys)) 1204 (let ((keys (epa--marked-keys))
1164 default-name) 1205 default-name)
@@ -1185,9 +1226,7 @@ Don't use this command in Lisp programs!"
1185 1226
1186;;;###autoload 1227;;;###autoload
1187(defun epa-insert-keys (keys) 1228(defun epa-insert-keys (keys)
1188 "Insert selected KEYS after the point. 1229 "Insert selected KEYS after the point."
1189
1190Don't use this command in Lisp programs!"
1191 (interactive 1230 (interactive
1192 (list (epa-select-keys (epg-make-context epa-protocol) 1231 (list (epa-select-keys (epg-make-context epa-protocol)
1193 "Select keys to export. "))) 1232 "Select keys to export. ")))
diff --git a/lisp/epg.el b/lisp/epg.el
index d7cd21e2ea5..e36592a9c7a 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -2411,7 +2411,7 @@ If you use this function, you will need to wait for the completion of
2411`epg-gpg-program' by using `epg-wait-for-completion' and call 2411`epg-gpg-program' by using `epg-wait-for-completion' and call
2412`epg-reset' to clear a temporaly output file. 2412`epg-reset' to clear a temporaly output file.
2413If you are unsure, use synchronous version of this function 2413If you are unsure, use synchronous version of this function
2414`epg-generate-key-from-file' or `epg-generate-key-from-string' instead." 2414`epg-receive-keys' instead."
2415 (epg-context-set-operation context 'receive-keys) 2415 (epg-context-set-operation context 'receive-keys)
2416 (epg-context-set-result context nil) 2416 (epg-context-set-result context nil)
2417 (epg--start context (cons "--recv-keys" key-id-list))) 2417 (epg--start context (cons "--recv-keys" key-id-list)))