summaryrefslogtreecommitdiff
path: root/lisp/epa-file.el
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@unixuser.org>2010-09-13 19:44:07 +0900
committerDaiki Ueno <ueno@unixuser.org>2010-09-13 19:44:07 +0900
commitc5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (patch)
tree7955bcbc0da4570e1b0530890d3a2d4c475b32f7 /lisp/epa-file.el
parented9a2f689685a562648c3de6f0b347820f24bf32 (diff)
downloademacs-c5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d.tar.gz
epa-file: suppress file-locking question on M-x revert-buffer
* epa-file.el (epa-file-insert-file-contents): If visiting, bind buffer-file-name to avoid file-locking. (Bug#7026)
Diffstat (limited to 'lisp/epa-file.el')
-rw-r--r--lisp/epa-file.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 24480ce3c76..3c6cf07ea1b 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -158,12 +158,17 @@ way."
(if (or beg end)
(setq string (substring string (or beg 0) end)))
(save-excursion
- (save-restriction
- (narrow-to-region (point) (point))
- (epa-file-decode-and-insert string file visit beg end replace)
- (setq length (- (point-max) (point-min))))
- (if replace
- (delete-region (point) (point-max)))
+ ;; If visiting, bind off buffer-file-name so that
+ ;; file-locking will not ask whether we should
+ ;; really edit the buffer.
+ (let ((buffer-file-name
+ (if visit nil buffer-file-name)))
+ (save-restriction
+ (narrow-to-region (point) (point))
+ (epa-file-decode-and-insert string file visit beg end replace)
+ (setq length (- (point-max) (point-min))))
+ (if replace
+ (delete-region (point) (point-max))))
(if visit
(set-visited-file-modtime))))
(if (and local-copy