-;;; epa-file.el --- the EasyPG Assistant, transparent file encryption
-;; Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+;;; epa-file.el --- the EasyPG Assistant, transparent file encryption -*- lexical-binding: t -*-
+;; Copyright (C) 2006-2014 Free Software Foundation, Inc.
;; Author: Daiki Ueno <ueno@unixuser.org>
;; Keywords: PGP, GnuPG
"If non-nil, cache passphrase for symmetric encryption.
For security reasons, this option is turned off by default and
-not recommended to use. Instead, consider using public-key
-encryption with gpg-agent which does the same job in a safer
-way."
+not recommended to use. Instead, consider using gpg-agent which
+does the same job in a safer way. See Info node `(epa) Caching
+Passphrases' for more information.
+
+Note that this option has no effect if you use GnuPG 2.0."
:type 'boolean
:group 'epa-file)
-(defcustom epa-file-select-keys 'silent
+(defcustom epa-file-select-keys nil
"Control whether or not to pop up the key selection dialog.
If t, always asks user to select recipients.
(error)))
(local-file (or local-copy file))
(context (epg-make-context))
+ (buf (current-buffer))
string length entry)
(if visit
(setq buffer-file-name file))
context
(cons #'epa-file-passphrase-callback-function
local-file))
- (epg-context-set-progress-callback context
- #'epa-progress-callback-function)
+ (epg-context-set-progress-callback
+ context
+ (cons #'epa-progress-callback-function
+ (format "Decrypting %s" file)))
(unwind-protect
(progn
(if replace
;; where `find-file-not-found-functions' are called in
;; `find-file-noselect-1'.
(when (file-exists-p local-file)
- (make-local-variable 'epa-file-error)
- (setq epa-file-error error)
+ (setq-local epa-file-error error)
(add-hook 'find-file-not-found-functions
'epa-file--find-file-not-found-function
nil t))
(signal 'file-error
(cons "Opening input file" (cdr error)))))
- (make-local-variable 'epa-file-encrypt-to)
- (setq epa-file-encrypt-to
- (mapcar #'car (epg-context-result-for context 'encrypted-to)))
+ (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)!
+ (setq-local epa-file-encrypt-to
+ (mapcar #'car (epg-context-result-for
+ context 'encrypted-to)))
(if (or beg end)
(setq string (substring string (or beg 0) end)))
(save-excursion
context
(cons #'epa-file-passphrase-callback-function
file))
- (epg-context-set-progress-callback context
- #'epa-progress-callback-function)
+ (epg-context-set-progress-callback
+ context
+ (cons #'epa-progress-callback-function
+ (format "Encrypting %s" file)))
(epg-context-set-armor context epa-armor)
(condition-case error
(setq string
(current-buffer)))))
(epa-select-keys
context
- "Select recipents for encryption.
+ "Select recipients for encryption.
If no one is selected, symmetric encryption will be performed. "
recipients)
(if epa-file-encrypt-to
(defun epa-file-select-keys ()
"Select recipients for encryption."
(interactive)
- (make-local-variable 'epa-file-encrypt-to)
- (setq epa-file-encrypt-to
- (mapcar
- (lambda (key)
- (epg-sub-key-id (car (epg-key-sub-key-list key))))
- (epa-select-keys
- (epg-make-context)
- "Select recipents for encryption.
+ (setq-local epa-file-encrypt-to
+ (mapcar
+ (lambda (key)
+ (epg-sub-key-id (car (epg-key-sub-key-list key))))
+ (epa-select-keys
+ (epg-make-context)
+ "Select recipients for encryption.
If no one is selected, symmetric encryption will be performed. "))))
;;;###autoload