(defvar epa-file-passphrase-alist nil)
+(if (fboundp 'encode-coding-string)
+ (defalias 'epa-file--encode-coding-string 'encode-coding-string)
+ (defalias 'epa-file--encode-coding-string 'identity))
+
+(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))
(point-min) (point-max)
(substring file 0 (string-match epa-file-name-regexp file))
visit beg end replace)))
- (insert (decode-coding-string string (or coding-system-for-read
- 'undecided)))))
+ (insert (epa-file--decode-coding-string string (or coding-system-for-read
+ 'undecided)))))
(defvar last-coding-system-used)
(defun epa-file-insert-file-contents (file &optional visit beg end replace)
(error "Can't append to the file."))
(setq file (expand-file-name file))
(let* ((coding-system (or coding-system-for-write
- (if (boundp 'last-coding-system-used)
- (condition-case nil
- (write-region (point-min) (point-max) "/")
- (error last-coding-system-used))
+ (if (fboundp 'select-safe-coding-system)
+ (select-safe-coding-system
+ (point-min) (point-max))
buffer-file-coding-system)))
(context (epg-make-context))
(coding-system-for-write 'binary)
(epg-encrypt-string
context
(if (stringp start)
- (encode-coding-string start coding-system)
- (encode-coding-string (buffer-substring start end)
- coding-system))
+ (epa-file--encode-coding-string start coding-system)
+ (epa-file--encode-coding-string (buffer-substring start end)
+ coding-system))
(unless (assoc file epa-file-passphrase-alist)
(epa-select-keys
context