(if (and visit (or beg end))
(error "Attempt to visit less than an entire file"))
(setq file (expand-file-name file))
- (let ((local-copy (epa-file-run-real-handler #'file-local-copy (list file)))
- (context (epg-make-context))
- string length entry)
+ (let* ((local-copy
+ (condition-case inl
+ (epa-file-run-real-handler #'file-local-copy (list file))
+ (error)))
+ (local-file (or local-copy file))
+ (context (epg-make-context))
+ string length entry)
(if visit
(setq buffer-file-name file))
(epg-context-set-passphrase-callback
context
(cons #'epa-file-passphrase-callback-function
- file))
+ local-file))
(epg-context-set-progress-callback context
#'epa-progress-callback-function)
(unwind-protect
(if replace
(goto-char (point-min)))
(condition-case error
- (setq string (epg-decrypt-file context file nil))
+ (setq string (epg-decrypt-file context local-file nil))
(error
(if (setq entry (assoc file epa-file-passphrase-alist))
(setcdr entry nil))
file))
(epg-context-set-progress-callback context
#'epa-progress-callback-function)
+ (epg-context-set-armor context epa-armor)
(condition-case error
(setq string
(epg-encrypt-string
(epa-file--encode-coding-string (buffer-substring start end)
coding-system))
(if (or epa-file-select-keys
- (not (local-variable-p 'epa-file-encrypt-to)))
+ (not (local-variable-p 'epa-file-encrypt-to
+ (current-buffer))))
(epa-select-keys
context
"Select recipents for encryption.
(if (and buffer-file-name
(string-match epa-file-name-regexp buffer-file-name)
epa-file-inhibit-auto-save)
- (auto-save-mode 0)))
+ (auto-save-mode 0))
+ (set-buffer-modified-p nil))
(defun epa-file-select-keys ()
"Select recipients for encryption."