aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDaiki Ueno2013-06-24 16:07:08 +0900
committerDaiki Ueno2013-06-24 16:07:08 +0900
commit18eb4bca3ec825790755f6779d54b74c335b8be9 (patch)
tree80bbe148783e66b9529c3441f422e68d4e3b4e20 /lisp
parentf99f7826a0303f7a40864571be7cbf84f3d4ee62 (diff)
downloademacs-18eb4bca3ec825790755f6779d54b74c335b8be9.tar.gz
emacs-18eb4bca3ec825790755f6779d54b74c335b8be9.zip
epg.el: Add context option `home-directory' and `program'.
* epg.el (epg-make-context): Check if PROTOCOL is valid; embed the file name of gpg executable. (epg-context-program): New function. (epg-context-home-directory): New function. (epg-context-set-program): New function. (epg-context-set-home-directory): New function. (epg--start): Use `epg-context-program' instead of 'epg-gpg-program'. (epg--list-keys-1): Likewise.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/epg.el121
2 files changed, 86 insertions, 47 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 440f66a9fe1..784415fb9b8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12013-06-24 Daiki Ueno <ueno@gnu.org>
2
3 * epg.el (epg-make-context): Check if PROTOCOL is valid; embed the
4 file name of gpg executable.
5 (epg-context-program): New function.
6 (epg-context-home-directory): New function.
7 (epg-context-set-program): New function.
8 (epg-context-set-home-directory): New function.
9 (epg--start): Use `epg-context-program' instead of
10 'epg-gpg-program'.
11 (epg--list-keys-1): Likewise.
12
12013-06-24 Leo Liu <sdl.web@gmail.com> 132013-06-24 Leo Liu <sdl.web@gmail.com>
2 14
3 * ido.el (ido-read-internal): Fix bug#14620. 15 * ido.el (ido-read-internal): Fix bug#14620.
diff --git a/lisp/epg.el b/lisp/epg.el
index c36de7e4624..06d972d6ffa 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -190,8 +190,17 @@
190 cipher-algorithm digest-algorithm 190 cipher-algorithm digest-algorithm
191 compress-algorithm) 191 compress-algorithm)
192 "Return a context object." 192 "Return a context object."
193 (unless protocol
194 (setq protocol 'OpenPGP))
195 (unless (memq protocol '(OpenPGP CMS))
196 (signal 'epg-error (list "unknown protocol" protocol)))
193 (cons 'epg-context 197 (cons 'epg-context
194 (vector (or protocol 'OpenPGP) armor textmode include-certs 198 (vector protocol
199 (if (eq protocol 'OpenPGP)
200 epg-gpg-program
201 epg-gpgsm-program)
202 epg-gpg-home-directory
203 armor textmode include-certs
195 cipher-algorithm digest-algorithm compress-algorithm 204 cipher-algorithm digest-algorithm compress-algorithm
196 (list #'epg-passphrase-callback-function) 205 (list #'epg-passphrase-callback-function)
197 nil 206 nil
@@ -203,97 +212,109 @@
203 (signal 'wrong-type-argument (list 'epg-context-p context))) 212 (signal 'wrong-type-argument (list 'epg-context-p context)))
204 (aref (cdr context) 0)) 213 (aref (cdr context) 0))
205 214
215(defun epg-context-program (context)
216 "Return the gpg or gpgsm executable used within CONTEXT."
217 (unless (eq (car-safe context) 'epg-context)
218 (signal 'wrong-type-argument (list 'epg-context-p context)))
219 (aref (cdr context) 1))
220
221(defun epg-context-home-directory (context)
222 "Return the GnuPG home directory used in CONTEXT."
223 (unless (eq (car-safe context) 'epg-context)
224 (signal 'wrong-type-argument (list 'epg-context-p context)))
225 (aref (cdr context) 2))
226
206(defun epg-context-armor (context) 227(defun epg-context-armor (context)
207 "Return t if the output should be ASCII armored in CONTEXT." 228 "Return t if the output should be ASCII armored in CONTEXT."
208 (unless (eq (car-safe context) 'epg-context) 229 (unless (eq (car-safe context) 'epg-context)
209 (signal 'wrong-type-argument (list 'epg-context-p context))) 230 (signal 'wrong-type-argument (list 'epg-context-p context)))
210 (aref (cdr context) 1)) 231 (aref (cdr context) 3))
211 232
212(defun epg-context-textmode (context) 233(defun epg-context-textmode (context)
213 "Return t if canonical text mode should be used in CONTEXT." 234 "Return t if canonical text mode should be used in CONTEXT."
214 (unless (eq (car-safe context) 'epg-context) 235 (unless (eq (car-safe context) 'epg-context)
215 (signal 'wrong-type-argument (list 'epg-context-p context))) 236 (signal 'wrong-type-argument (list 'epg-context-p context)))
216 (aref (cdr context) 2)) 237 (aref (cdr context) 4))
217 238
218(defun epg-context-include-certs (context) 239(defun epg-context-include-certs (context)
219 "Return how many certificates should be included in an S/MIME signed message." 240 "Return how many certificates should be included in an S/MIME signed message."
220 (unless (eq (car-safe context) 'epg-context) 241 (unless (eq (car-safe context) 'epg-context)
221 (signal 'wrong-type-argument (list 'epg-context-p context))) 242 (signal 'wrong-type-argument (list 'epg-context-p context)))
222 (aref (cdr context) 3)) 243 (aref (cdr context) 5))
223 244
224(defun epg-context-cipher-algorithm (context) 245(defun epg-context-cipher-algorithm (context)
225 "Return the cipher algorithm in CONTEXT." 246 "Return the cipher algorithm in CONTEXT."
226 (unless (eq (car-safe context) 'epg-context) 247 (unless (eq (car-safe context) 'epg-context)
227 (signal 'wrong-type-argument (list 'epg-context-p context))) 248 (signal 'wrong-type-argument (list 'epg-context-p context)))
228 (aref (cdr context) 4)) 249 (aref (cdr context) 6))
229 250
230(defun epg-context-digest-algorithm (context) 251(defun epg-context-digest-algorithm (context)
231 "Return the digest algorithm in CONTEXT." 252 "Return the digest algorithm in CONTEXT."
232 (unless (eq (car-safe context) 'epg-context) 253 (unless (eq (car-safe context) 'epg-context)
233 (signal 'wrong-type-argument (list 'epg-context-p context))) 254 (signal 'wrong-type-argument (list 'epg-context-p context)))
234 (aref (cdr context) 5)) 255 (aref (cdr context) 7))
235 256
236(defun epg-context-compress-algorithm (context) 257(defun epg-context-compress-algorithm (context)
237 "Return the compress algorithm in CONTEXT." 258 "Return the compress algorithm in CONTEXT."
238 (unless (eq (car-safe context) 'epg-context) 259 (unless (eq (car-safe context) 'epg-context)
239 (signal 'wrong-type-argument (list 'epg-context-p context))) 260 (signal 'wrong-type-argument (list 'epg-context-p context)))
240 (aref (cdr context) 6)) 261 (aref (cdr context) 8))
241 262
242(defun epg-context-passphrase-callback (context) 263(defun epg-context-passphrase-callback (context)
243 "Return the function used to query passphrase." 264 "Return the function used to query passphrase."
244 (unless (eq (car-safe context) 'epg-context) 265 (unless (eq (car-safe context) 'epg-context)
245 (signal 'wrong-type-argument (list 'epg-context-p context))) 266 (signal 'wrong-type-argument (list 'epg-context-p context)))
246 (aref (cdr context) 7)) 267 (aref (cdr context) 9))
247 268
248(defun epg-context-progress-callback (context) 269(defun epg-context-progress-callback (context)
249 "Return the function which handles progress update." 270 "Return the function which handles progress update."
250 (unless (eq (car-safe context) 'epg-context) 271 (unless (eq (car-safe context) 'epg-context)
251 (signal 'wrong-type-argument (list 'epg-context-p context))) 272 (signal 'wrong-type-argument (list 'epg-context-p context)))
252 (aref (cdr context) 8)) 273 (aref (cdr context) 10))
253 274
254(defun epg-context-signers (context) 275(defun epg-context-signers (context)
255 "Return the list of key-id for signing." 276 "Return the list of key-id for signing."
256 (unless (eq (car-safe context) 'epg-context) 277 (unless (eq (car-safe context) 'epg-context)
257 (signal 'wrong-type-argument (list 'epg-context-p context))) 278 (signal 'wrong-type-argument (list 'epg-context-p context)))
258 (aref (cdr context) 9)) 279 (aref (cdr context) 11))
259 280
260(defun epg-context-sig-notations (context) 281(defun epg-context-sig-notations (context)
261 "Return the list of notations for signing." 282 "Return the list of notations for signing."
262 (unless (eq (car-safe context) 'epg-context) 283 (unless (eq (car-safe context) 'epg-context)
263 (signal 'wrong-type-argument (list 'epg-context-p context))) 284 (signal 'wrong-type-argument (list 'epg-context-p context)))
264 (aref (cdr context) 10)) 285 (aref (cdr context) 12))
265 286
266(defun epg-context-process (context) 287(defun epg-context-process (context)
267 "Return the process object of `epg-gpg-program'. 288 "Return the process object of `epg-gpg-program'.
268This function is for internal use only." 289This function is for internal use only."
269 (unless (eq (car-safe context) 'epg-context) 290 (unless (eq (car-safe context) 'epg-context)
270 (signal 'wrong-type-argument (list 'epg-context-p context))) 291 (signal 'wrong-type-argument (list 'epg-context-p context)))
271 (aref (cdr context) 11)) 292 (aref (cdr context) 13))
272 293
273(defun epg-context-output-file (context) 294(defun epg-context-output-file (context)
274 "Return the output file of `epg-gpg-program'. 295 "Return the output file of `epg-gpg-program'.
275This function is for internal use only." 296This function is for internal use only."
276 (unless (eq (car-safe context) 'epg-context) 297 (unless (eq (car-safe context) 'epg-context)
277 (signal 'wrong-type-argument (list 'epg-context-p context))) 298 (signal 'wrong-type-argument (list 'epg-context-p context)))
278 (aref (cdr context) 12)) 299 (aref (cdr context) 14))
279 300
280(defun epg-context-result (context) 301(defun epg-context-result (context)
281 "Return the result of the previous cryptographic operation." 302 "Return the result of the previous cryptographic operation."
282 (unless (eq (car-safe context) 'epg-context) 303 (unless (eq (car-safe context) 'epg-context)
283 (signal 'wrong-type-argument (list 'epg-context-p context))) 304 (signal 'wrong-type-argument (list 'epg-context-p context)))
284 (aref (cdr context) 13)) 305 (aref (cdr context) 15))
285 306
286(defun epg-context-operation (context) 307(defun epg-context-operation (context)
287 "Return the name of the current cryptographic operation." 308 "Return the name of the current cryptographic operation."
288 (unless (eq (car-safe context) 'epg-context) 309 (unless (eq (car-safe context) 'epg-context)
289 (signal 'wrong-type-argument (list 'epg-context-p context))) 310 (signal 'wrong-type-argument (list 'epg-context-p context)))
290 (aref (cdr context) 14)) 311 (aref (cdr context) 16))
291 312
292(defun epg-context-pinentry-mode (context) 313(defun epg-context-pinentry-mode (context)
293 "Return the mode of pinentry invocation." 314 "Return the mode of pinentry invocation."
294 (unless (eq (car-safe context) 'epg-context) 315 (unless (eq (car-safe context) 'epg-context)
295 (signal 'wrong-type-argument (list 'epg-context-p context))) 316 (signal 'wrong-type-argument (list 'epg-context-p context)))
296 (aref (cdr context) 15)) 317 (aref (cdr context) 17))
297 318
298(defun epg-context-set-protocol (context protocol) 319(defun epg-context-set-protocol (context protocol)
299 "Set the protocol used within CONTEXT." 320 "Set the protocol used within CONTEXT."
@@ -301,41 +322,53 @@ This function is for internal use only."
301 (signal 'wrong-type-argument (list 'epg-context-p context))) 322 (signal 'wrong-type-argument (list 'epg-context-p context)))
302 (aset (cdr context) 0 protocol)) 323 (aset (cdr context) 0 protocol))
303 324
325(defun epg-context-set-program (context protocol)
326 "Set the gpg or gpgsm executable used within CONTEXT."
327 (unless (eq (car-safe context) 'epg-context)
328 (signal 'wrong-type-argument (list 'epg-context-p context)))
329 (aset (cdr context) 1 protocol))
330
331(defun epg-context-set-home-directory (context directory)
332 "Set the GnuPG home directory."
333 (unless (eq (car-safe context) 'epg-context)
334 (signal 'wrong-type-argument (list 'epg-context-p context)))
335 (aset (cdr context) 2 directory))
336
304(defun epg-context-set-armor (context armor) 337(defun epg-context-set-armor (context armor)
305 "Specify if the output should be ASCII armored in CONTEXT." 338 "Specify if the output should be ASCII armored in CONTEXT."
306 (unless (eq (car-safe context) 'epg-context) 339 (unless (eq (car-safe context) 'epg-context)
307 (signal 'wrong-type-argument (list 'epg-context-p context))) 340 (signal 'wrong-type-argument (list 'epg-context-p context)))
308 (aset (cdr context) 1 armor)) 341 (aset (cdr context) 3 armor))
309 342
310(defun epg-context-set-textmode (context textmode) 343(defun epg-context-set-textmode (context textmode)
311 "Specify if canonical text mode should be used in CONTEXT." 344 "Specify if canonical text mode should be used in CONTEXT."
312 (unless (eq (car-safe context) 'epg-context) 345 (unless (eq (car-safe context) 'epg-context)
313 (signal 'wrong-type-argument (list 'epg-context-p context))) 346 (signal 'wrong-type-argument (list 'epg-context-p context)))
314 (aset (cdr context) 2 textmode)) 347 (aset (cdr context) 4 textmode))
315 348
316(defun epg-context-set-include-certs (context include-certs) 349(defun epg-context-set-include-certs (context include-certs)
317 "Set how many certificates should be included in an S/MIME signed message." 350 "Set how many certificates should be included in an S/MIME signed message."
318 (unless (eq (car-safe context) 'epg-context) 351 (unless (eq (car-safe context) 'epg-context)
319 (signal 'wrong-type-argument (list 'epg-context-p context))) 352 (signal 'wrong-type-argument (list 'epg-context-p context)))
320 (aset (cdr context) 3 include-certs)) 353 (aset (cdr context) 5 include-certs))
321 354
322(defun epg-context-set-cipher-algorithm (context cipher-algorithm) 355(defun epg-context-set-cipher-algorithm (context cipher-algorithm)
323 "Set the cipher algorithm in CONTEXT." 356 "Set the cipher algorithm in CONTEXT."
324 (unless (eq (car-safe context) 'epg-context) 357 (unless (eq (car-safe context) 'epg-context)
325 (signal 'wrong-type-argument (list 'epg-context-p context))) 358 (signal 'wrong-type-argument (list 'epg-context-p context)))
326 (aset (cdr context) 4 cipher-algorithm)) 359 (aset (cdr context) 6 cipher-algorithm))
327 360
328(defun epg-context-set-digest-algorithm (context digest-algorithm) 361(defun epg-context-set-digest-algorithm (context digest-algorithm)
329 "Set the digest algorithm in CONTEXT." 362 "Set the digest algorithm in CONTEXT."
330 (unless (eq (car-safe context) 'epg-context) 363 (unless (eq (car-safe context) 'epg-context)
331 (signal 'wrong-type-argument (list 'epg-context-p context))) 364 (signal 'wrong-type-argument (list 'epg-context-p context)))
332 (aset (cdr context) 5 digest-algorithm)) 365 (aset (cdr context) 7 digest-algorithm))
333 366
334(defun epg-context-set-compress-algorithm (context compress-algorithm) 367(defun epg-context-set-compress-algorithm (context compress-algorithm)
335 "Set the compress algorithm in CONTEXT." 368 "Set the compress algorithm in CONTEXT."
336 (unless (eq (car-safe context) 'epg-context) 369 (unless (eq (car-safe context) 'epg-context)
337 (signal 'wrong-type-argument (list 'epg-context-p context))) 370 (signal 'wrong-type-argument (list 'epg-context-p context)))
338 (aset (cdr context) 6 compress-algorithm)) 371 (aset (cdr context) 8 compress-algorithm))
339 372
340(defun epg-context-set-passphrase-callback (context 373(defun epg-context-set-passphrase-callback (context
341 passphrase-callback) 374 passphrase-callback)
@@ -354,7 +387,7 @@ installing GnuPG 1.x _along with_ GnuPG 2.x, which does passphrase
354query by itself and Emacs can intercept them." 387query by itself and Emacs can intercept them."
355 (unless (eq (car-safe context) 'epg-context) 388 (unless (eq (car-safe context) 'epg-context)
356 (signal 'wrong-type-argument (list 'epg-context-p context))) 389 (signal 'wrong-type-argument (list 'epg-context-p context)))
357 (aset (cdr context) 7 (if (consp passphrase-callback) 390 (aset (cdr context) 9 (if (consp passphrase-callback)
358 passphrase-callback 391 passphrase-callback
359 (list passphrase-callback)))) 392 (list passphrase-callback))))
360 393
@@ -371,7 +404,7 @@ current amount done, the total amount to be done, and the
371callback data (if any)." 404callback data (if any)."
372 (unless (eq (car-safe context) 'epg-context) 405 (unless (eq (car-safe context) 'epg-context)
373 (signal 'wrong-type-argument (list 'epg-context-p context))) 406 (signal 'wrong-type-argument (list 'epg-context-p context)))
374 (aset (cdr context) 8 (if (consp progress-callback) 407 (aset (cdr context) 10 (if (consp progress-callback)
375 progress-callback 408 progress-callback
376 (list progress-callback)))) 409 (list progress-callback))))
377 410
@@ -379,39 +412,39 @@ callback data (if any)."
379 "Set the list of key-id for signing." 412 "Set the list of key-id for signing."
380 (unless (eq (car-safe context) 'epg-context) 413 (unless (eq (car-safe context) 'epg-context)
381 (signal 'wrong-type-argument (list 'epg-context-p context))) 414 (signal 'wrong-type-argument (list 'epg-context-p context)))
382 (aset (cdr context) 9 signers)) 415 (aset (cdr context) 11 signers))
383 416
384(defun epg-context-set-sig-notations (context notations) 417(defun epg-context-set-sig-notations (context notations)
385 "Set the list of notations for signing." 418 "Set the list of notations for signing."
386 (unless (eq (car-safe context) 'epg-context) 419 (unless (eq (car-safe context) 'epg-context)
387 (signal 'wrong-type-argument (list 'epg-context-p context))) 420 (signal 'wrong-type-argument (list 'epg-context-p context)))
388 (aset (cdr context) 10 notations)) 421 (aset (cdr context) 12 notations))
389 422
390(defun epg-context-set-process (context process) 423(defun epg-context-set-process (context process)
391 "Set the process object of `epg-gpg-program'. 424 "Set the process object of `epg-gpg-program'.
392This function is for internal use only." 425This function is for internal use only."
393 (unless (eq (car-safe context) 'epg-context) 426 (unless (eq (car-safe context) 'epg-context)
394 (signal 'wrong-type-argument (list 'epg-context-p context))) 427 (signal 'wrong-type-argument (list 'epg-context-p context)))
395 (aset (cdr context) 11 process)) 428 (aset (cdr context) 13 process))
396 429
397(defun epg-context-set-output-file (context output-file) 430(defun epg-context-set-output-file (context output-file)
398 "Set the output file of `epg-gpg-program'. 431 "Set the output file of `epg-gpg-program'.
399This function is for internal use only." 432This function is for internal use only."
400 (unless (eq (car-safe context) 'epg-context) 433 (unless (eq (car-safe context) 'epg-context)
401 (signal 'wrong-type-argument (list 'epg-context-p context))) 434 (signal 'wrong-type-argument (list 'epg-context-p context)))
402 (aset (cdr context) 12 output-file)) 435 (aset (cdr context) 14 output-file))
403 436
404(defun epg-context-set-result (context result) 437(defun epg-context-set-result (context result)
405 "Set the result of the previous cryptographic operation." 438 "Set the result of the previous cryptographic operation."
406 (unless (eq (car-safe context) 'epg-context) 439 (unless (eq (car-safe context) 'epg-context)
407 (signal 'wrong-type-argument (list 'epg-context-p context))) 440 (signal 'wrong-type-argument (list 'epg-context-p context)))
408 (aset (cdr context) 13 result)) 441 (aset (cdr context) 15 result))
409 442
410(defun epg-context-set-operation (context operation) 443(defun epg-context-set-operation (context operation)
411 "Set the name of the current cryptographic operation." 444 "Set the name of the current cryptographic operation."
412 (unless (eq (car-safe context) 'epg-context) 445 (unless (eq (car-safe context) 'epg-context)
413 (signal 'wrong-type-argument (list 'epg-context-p context))) 446 (signal 'wrong-type-argument (list 'epg-context-p context)))
414 (aset (cdr context) 14 operation)) 447 (aset (cdr context) 16 operation))
415 448
416(defun epg-context-set-pinentry-mode (context mode) 449(defun epg-context-set-pinentry-mode (context mode)
417 "Set the mode of pinentry invocation." 450 "Set the mode of pinentry invocation."
@@ -419,7 +452,7 @@ This function is for internal use only."
419 (signal 'wrong-type-argument (list 'epg-context-p context))) 452 (signal 'wrong-type-argument (list 'epg-context-p context)))
420 (unless (memq mode '(nil ask cancel error loopback)) 453 (unless (memq mode '(nil ask cancel error loopback))
421 (signal 'epg-error (list "Unknown pinentry mode" mode))) 454 (signal 'epg-error (list "Unknown pinentry mode" mode)))
422 (aset (cdr context) 15 mode)) 455 (aset (cdr context) 17 mode))
423 456
424(defun epg-make-signature (status &optional key-id) 457(defun epg-make-signature (status &optional key-id)
425 "Return a signature object." 458 "Return a signature object."
@@ -1145,9 +1178,7 @@ This function is for internal use only."
1145 (if (and (epg-context-process context) 1178 (if (and (epg-context-process context)
1146 (eq (process-status (epg-context-process context)) 'run)) 1179 (eq (process-status (epg-context-process context)) 'run))
1147 (error "%s is already running in this context" 1180 (error "%s is already running in this context"
1148 (if (eq (epg-context-protocol context) 'CMS) 1181 (epg-context-program context)))
1149 epg-gpgsm-program
1150 epg-gpg-program)))
1151 (let* ((agent-info (getenv "GPG_AGENT_INFO")) 1182 (let* ((agent-info (getenv "GPG_AGENT_INFO"))
1152 (args (append (list "--no-tty" 1183 (args (append (list "--no-tty"
1153 "--status-fd" "1" 1184 "--status-fd" "1"
@@ -1158,8 +1189,9 @@ This function is for internal use only."
1158 (if (and (not (eq (epg-context-protocol context) 'CMS)) 1189 (if (and (not (eq (epg-context-protocol context) 'CMS))
1159 (epg-context-progress-callback context)) 1190 (epg-context-progress-callback context))
1160 '("--enable-progress-filter")) 1191 '("--enable-progress-filter"))
1161 (if epg-gpg-home-directory 1192 (if (epg-context-home-directory context)
1162 (list "--homedir" epg-gpg-home-directory)) 1193 (list "--homedir"
1194 (epg-context-home-directory context)))
1163 (unless (eq (epg-context-protocol context) 'CMS) 1195 (unless (eq (epg-context-protocol context) 'CMS)
1164 '("--command-fd" "0")) 1196 '("--command-fd" "0"))
1165 (if (epg-context-armor context) '("--armor")) 1197 (if (epg-context-armor context) '("--armor"))
@@ -1213,9 +1245,7 @@ This function is for internal use only."
1213 (format "GPG_AGENT_INFO=%s\n" agent-info) 1245 (format "GPG_AGENT_INFO=%s\n" agent-info)
1214 "GPG_AGENT_INFO is not set\n") 1246 "GPG_AGENT_INFO is not set\n")
1215 (format "%s %s\n" 1247 (format "%s %s\n"
1216 (if (eq (epg-context-protocol context) 'CMS) 1248 (epg-context-program context)
1217 epg-gpgsm-program
1218 epg-gpg-program)
1219 (mapconcat #'identity args " "))))) 1249 (mapconcat #'identity args " ")))))
1220 (with-current-buffer buffer 1250 (with-current-buffer buffer
1221 (if (fboundp 'set-buffer-multibyte) 1251 (if (fboundp 'set-buffer-multibyte)
@@ -1241,9 +1271,7 @@ This function is for internal use only."
1241 (set-default-file-modes 448) 1271 (set-default-file-modes 448)
1242 (setq process 1272 (setq process
1243 (apply #'start-process "epg" buffer 1273 (apply #'start-process "epg" buffer
1244 (if (eq (epg-context-protocol context) 'CMS) 1274 (epg-context-program context)
1245 epg-gpgsm-program
1246 epg-gpg-program)
1247 args))) 1275 args)))
1248 (set-default-file-modes orig-mode)) 1276 (set-default-file-modes orig-mode))
1249 (set-process-filter process #'epg--process-filter) 1277 (set-process-filter process #'epg--process-filter)
@@ -1854,8 +1882,9 @@ This function is for internal use only."
1854 (format "Passphrase for %s: " key-id))))))) 1882 (format "Passphrase for %s: " key-id)))))))
1855 1883
1856(defun epg--list-keys-1 (context name mode) 1884(defun epg--list-keys-1 (context name mode)
1857 (let ((args (append (if epg-gpg-home-directory 1885 (let ((args (append (if (epg-context-home-directory context)
1858 (list "--homedir" epg-gpg-home-directory)) 1886 (list "--homedir"
1887 (epg-context-home-directory context)))
1859 '("--with-colons" "--no-greeting" "--batch" 1888 '("--with-colons" "--no-greeting" "--batch"
1860 "--with-fingerprint" "--with-fingerprint") 1889 "--with-fingerprint" "--with-fingerprint")
1861 (unless (eq (epg-context-protocol context) 'CMS) 1890 (unless (eq (epg-context-protocol context) 'CMS)
@@ -1877,9 +1906,7 @@ This function is for internal use only."
1877 (setq args (append args (list list-keys-option)))) 1906 (setq args (append args (list list-keys-option))))
1878 (with-temp-buffer 1907 (with-temp-buffer
1879 (apply #'call-process 1908 (apply #'call-process
1880 (if (eq (epg-context-protocol context) 'CMS) 1909 (epg-context-program context)
1881 epg-gpgsm-program
1882 epg-gpg-program)
1883 nil (list t nil) nil args) 1910 nil (list t nil) nil args)
1884 (goto-char (point-min)) 1911 (goto-char (point-min))
1885 (while (re-search-forward "^[a-z][a-z][a-z]:.*" nil t) 1912 (while (re-search-forward "^[a-z][a-z][a-z]:.*" nil t)