aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDaiki Ueno <[email protected]>2010-09-13 19:44:07 +0900
committerDaiki Ueno <[email protected]>2010-09-13 19:44:07 +0900
commitc5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (patch)
tree7955bcbc0da4570e1b0530890d3a2d4c475b32f7 /lisp
parented9a2f689685a562648c3de6f0b347820f24bf32 (diff)
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')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/epa-file.el17
2 files changed, 16 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dec338e36d..f0e59a6c6a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-13 Daiki Ueno <[email protected]>
+
+ * epa-file.el (epa-file-insert-file-contents): If visiting, bind
+ buffer-file-name to avoid file-locking. (Bug#7026)
+
2010-09-13 Julien Danjou <[email protected]>
* notifications.el (notifications-notify): Add support for
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 24480ce3c7..3c6cf07ea1 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