[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116024: * epa-file.el: Respect buffer-file-format w
From: |
Daiki Ueno |
Subject: |
[Emacs-diffs] trunk r116024: * epa-file.el: Respect buffer-file-format when writing |
Date: |
Tue, 14 Jan 2014 08:42:57 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116024
revision-id: address@hidden
parent: address@hidden
committer: Daiki Ueno <address@hidden>
branch nick: trunk
timestamp: Tue 2014-01-14 17:41:09 +0900
message:
* epa-file.el: Respect buffer-file-format when writing
* epa-file.el (epa-file-write-region): Encode the region according
to `buffer-file-format'. Problem reported at:
<http://sourceforge.jp/ticket/browse.php?group_id=2267&tid=32917>.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/epa-file.el epafile.el-20091113204419-o5vbwnq5f7feedwu-8554
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-01-14 08:13:13 +0000
+++ b/lisp/ChangeLog 2014-01-14 08:41:09 +0000
@@ -1,3 +1,9 @@
+2014-01-14 Daiki Ueno <address@hidden>
+
+ * epa-file.el (epa-file-write-region): Encode the region according
+ to `buffer-file-format'. Problem reported at:
+ <http://sourceforge.jp/ticket/browse.php?group_id=2267&tid=32917>.
+
2014-01-14 Stefan Monnier <address@hidden>
* emacs-lisp/edebug.el (edebug--display): Move protective let-binding
=== modified file 'lisp/epa-file.el'
--- a/lisp/epa-file.el 2014-01-01 07:43:34 +0000
+++ b/lisp/epa-file.el 2014-01-14 08:41:09 +0000
@@ -211,7 +211,8 @@
(recipients
(cond
((listp epa-file-encrypt-to) epa-file-encrypt-to)
- ((stringp epa-file-encrypt-to) (list epa-file-encrypt-to)))))
+ ((stringp epa-file-encrypt-to) (list epa-file-encrypt-to))))
+ buffer)
(epg-context-set-passphrase-callback
context
(cons #'epa-file-passphrase-callback-function
@@ -230,8 +231,18 @@
(unless start
(setq start (point-min)
end (point-max)))
- (epa-file--encode-coding-string (buffer-substring start end)
- coding-system))
+ (setq buffer (current-buffer))
+ (with-temp-buffer
+ (insert-buffer-substring buffer start end)
+ ;; Translate the region according to
+ ;; `buffer-file-format', as `write-region' would.
+ ;; We can't simply do `write-region' (into a
+ ;; temporary file) here, since it writes out
+ ;; decrypted contents.
+ (format-encode-buffer (with-current-buffer buffer
+ buffer-file-format))
+ (epa-file--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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116024: * epa-file.el: Respect buffer-file-format when writing,
Daiki Ueno <=