diff options
| author | Daiki Ueno | 2010-09-13 19:44:07 +0900 |
|---|---|---|
| committer | Daiki Ueno | 2010-09-13 19:44:07 +0900 |
| commit | c5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (patch) | |
| tree | 7955bcbc0da4570e1b0530890d3a2d4c475b32f7 | |
| parent | ed9a2f689685a562648c3de6f0b347820f24bf32 (diff) | |
| download | emacs-c5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d.tar.gz emacs-c5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d.zip | |
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)
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/epa-file.el | 17 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dec338e36d6..f0e59a6c6a6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-09-13 Daiki Ueno <ueno@unixuser.org> | ||
| 2 | |||
| 3 | * epa-file.el (epa-file-insert-file-contents): If visiting, bind | ||
| 4 | buffer-file-name to avoid file-locking. (Bug#7026) | ||
| 5 | |||
| 1 | 2010-09-13 Julien Danjou <julien@danjou.info> | 6 | 2010-09-13 Julien Danjou <julien@danjou.info> |
| 2 | 7 | ||
| 3 | * notifications.el (notifications-notify): Add support for | 8 | * notifications.el (notifications-notify): Add support for |
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." | |||
| 158 | (if (or beg end) | 158 | (if (or beg end) |
| 159 | (setq string (substring string (or beg 0) end))) | 159 | (setq string (substring string (or beg 0) end))) |
| 160 | (save-excursion | 160 | (save-excursion |
| 161 | (save-restriction | 161 | ;; If visiting, bind off buffer-file-name so that |
| 162 | (narrow-to-region (point) (point)) | 162 | ;; file-locking will not ask whether we should |
| 163 | (epa-file-decode-and-insert string file visit beg end replace) | 163 | ;; really edit the buffer. |
| 164 | (setq length (- (point-max) (point-min)))) | 164 | (let ((buffer-file-name |
| 165 | (if replace | 165 | (if visit nil buffer-file-name))) |
| 166 | (delete-region (point) (point-max))) | 166 | (save-restriction |
| 167 | (narrow-to-region (point) (point)) | ||
| 168 | (epa-file-decode-and-insert string file visit beg end replace) | ||
| 169 | (setq length (- (point-max) (point-min)))) | ||
| 170 | (if replace | ||
| 171 | (delete-region (point) (point-max)))) | ||
| 167 | (if visit | 172 | (if visit |
| 168 | (set-visited-file-modtime)))) | 173 | (set-visited-file-modtime)))) |
| 169 | (if (and local-copy | 174 | (if (and local-copy |