summaryrefslogtreecommitdiff
path: root/lisp/epa-file.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-07-15 23:13:59 +0200
committerAndrea Corallo <akrl@sdf.org>2020-07-15 23:13:59 +0200
commit907618b3b51a653d111d7f5764da586fcee6da5e (patch)
treeddde8eb9f40da415fc7699d16948eb9638804588 /lisp/epa-file.el
parent2c2cc21f1be721e5ba30fa22aedeb5c254791193 (diff)
parent85eaa8373bb0a91013af503d333670788ec5a956 (diff)
downloademacs-907618b3b51a653d111d7f5764da586fcee6da5e.tar.gz
emacs-907618b3b51a653d111d7f5764da586fcee6da5e.tar.bz2
emacs-907618b3b51a653d111d7f5764da586fcee6da5e.zip
Merge remote-tracking branch 'savahnna/master' into HEAD
Diffstat (limited to 'lisp/epa-file.el')
-rw-r--r--lisp/epa-file.el30
1 files changed, 8 insertions, 22 deletions
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index dedf20b0d77..20043a9eae4 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -40,9 +40,9 @@ Note that this option has no effect if you use GnuPG 2.0."
(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.
+If t, always ask user to select recipients.
If nil, query user only when `epa-file-encrypt-to' is not set.
-If neither t nor nil, doesn't ask user. In this case, symmetric
+If neither t nor nil, don't ask user. In this case, symmetric
encryption is used."
:type '(choice (const :tag "Ask always" t)
(const :tag "Ask when recipients are not set" nil)
@@ -51,16 +51,6 @@ encryption is used."
(defvar epa-file-passphrase-alist nil)
-(eval-and-compile
- (if (fboundp 'encode-coding-string)
- (defalias 'epa-file--encode-coding-string 'encode-coding-string)
- (defalias 'epa-file--encode-coding-string 'identity)))
-
-(eval-and-compile
- (if (fboundp 'decode-coding-string)
- (defalias 'epa-file--decode-coding-string 'decode-coding-string)
- (defalias 'epa-file--decode-coding-string 'identity)))
-
(defun epa-file-passphrase-callback-function (context key-id file)
(if (and epa-file-cache-passphrase-for-symmetric-encryption
(eq key-id 'SYM))
@@ -71,8 +61,8 @@ encryption is used."
(or (copy-sequence (cdr entry))
(progn
(unless entry
- (setq entry (list file)
- epa-file-passphrase-alist
+ (setq entry (list file))
+ (setq epa-file-passphrase-alist
(cons entry
epa-file-passphrase-alist)))
(setq passphrase (epa-passphrase-callback-function context
@@ -236,11 +226,7 @@ encryption is used."
(setq file (expand-file-name file))
(let* ((coding-system (or coding-system-for-write
(if (fboundp 'select-safe-coding-system)
- ;; This is needed since Emacs 22 has
- ;; no-conversion setting for *.gpg in
- ;; `auto-coding-alist'.
- (let ((buffer-file-name
- (file-name-sans-extension file)))
+ (let ((buffer-file-name file))
(select-safe-coding-system
(point-min) (point-max)))
buffer-file-coding-system)))
@@ -266,7 +252,7 @@ encryption is used."
(epg-encrypt-string
context
(if (stringp start)
- (epa-file--encode-coding-string start coding-system)
+ (encode-coding-string start coding-system)
(unless start
(setq start (point-min)
end (point-max)))
@@ -280,8 +266,8 @@ encryption is used."
;; decrypted contents.
(format-encode-buffer (with-current-buffer buffer
buffer-file-format))
- (epa-file--encode-coding-string (buffer-string)
- coding-system)))
+ (encode-coding-string (buffer-string)
+ coding-system)))
(if (or (eq epa-file-select-keys t)
(and (null epa-file-select-keys)
(not (local-variable-p 'epa-file-encrypt-to