diff options
Diffstat (limited to 'lisp/epa-file.el')
-rw-r--r-- | lisp/epa-file.el | 17 |
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 |