# HG changeset patch # User Daiki Ueno <ueno@unixuser.org> # Date 1284374647 -32400 # Node ID 3386110d149b006d89a597a32922e0c16bd0a69b # Parent 50478146a2e1b3af63c532034a0c600eef6942f6 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) diff -r 50478146a2e1 -r 3386110d149b lisp/ChangeLog --- a/lisp/ChangeLog Mon Sep 13 10:14:52 2010 +0000 +++ b/lisp/ChangeLog Mon Sep 13 19:44:07 2010 +0900 @@ -1,3 +1,8 @@ +2010-09-13 Daiki Ueno <ueno@unixuser.org> + + * 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 <julien@danjou.info> * notifications.el (notifications-notify): Add support for diff -r 50478146a2e1 -r 3386110d149b lisp/epa-file.el --- a/lisp/epa-file.el Mon Sep 13 10:14:52 2010 +0000 +++ b/lisp/epa-file.el Mon Sep 13 19:44:07 2010 +0900 @@ -158,12 +158,17 @@ (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