diff options
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/epa-file.el | 17 |
2 files changed, 20 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e45b0ba0574..243078ebad4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-01-14 Daiki Ueno <ueno@gnu.org> | ||
| 2 | |||
| 3 | * epa-file.el (epa-file-write-region): Encode the region according | ||
| 4 | to `buffer-file-format'. Problem reported at: | ||
| 5 | <http://sourceforge.jp/ticket/browse.php?group_id=2267&tid=32917>. | ||
| 6 | |||
| 1 | 2014-01-14 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2014-01-14 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * emacs-lisp/edebug.el (edebug--display): Move protective let-binding | 9 | * emacs-lisp/edebug.el (edebug--display): Move protective let-binding |
diff --git a/lisp/epa-file.el b/lisp/epa-file.el index eea458d200d..20d34f82223 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el | |||
| @@ -211,7 +211,8 @@ encryption is used." | |||
| 211 | (recipients | 211 | (recipients |
| 212 | (cond | 212 | (cond |
| 213 | ((listp epa-file-encrypt-to) epa-file-encrypt-to) | 213 | ((listp epa-file-encrypt-to) epa-file-encrypt-to) |
| 214 | ((stringp epa-file-encrypt-to) (list epa-file-encrypt-to))))) | 214 | ((stringp epa-file-encrypt-to) (list epa-file-encrypt-to)))) |
| 215 | buffer) | ||
| 215 | (epg-context-set-passphrase-callback | 216 | (epg-context-set-passphrase-callback |
| 216 | context | 217 | context |
| 217 | (cons #'epa-file-passphrase-callback-function | 218 | (cons #'epa-file-passphrase-callback-function |
| @@ -230,8 +231,18 @@ encryption is used." | |||
| 230 | (unless start | 231 | (unless start |
| 231 | (setq start (point-min) | 232 | (setq start (point-min) |
| 232 | end (point-max))) | 233 | end (point-max))) |
| 233 | (epa-file--encode-coding-string (buffer-substring start end) | 234 | (setq buffer (current-buffer)) |
| 234 | coding-system)) | 235 | (with-temp-buffer |
| 236 | (insert-buffer-substring buffer start end) | ||
| 237 | ;; Translate the region according to | ||
| 238 | ;; `buffer-file-format', as `write-region' would. | ||
| 239 | ;; We can't simply do `write-region' (into a | ||
| 240 | ;; temporary file) here, since it writes out | ||
| 241 | ;; decrypted contents. | ||
| 242 | (format-encode-buffer (with-current-buffer buffer | ||
| 243 | buffer-file-format)) | ||
| 244 | (epa-file--encode-coding-string (buffer-string) | ||
| 245 | coding-system))) | ||
| 235 | (if (or (eq epa-file-select-keys t) | 246 | (if (or (eq epa-file-select-keys t) |
| 236 | (and (null epa-file-select-keys) | 247 | (and (null epa-file-select-keys) |
| 237 | (not (local-variable-p 'epa-file-encrypt-to | 248 | (not (local-variable-p 'epa-file-encrypt-to |