emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101419: epa-file: suppress file-lock


From: Daiki Ueno
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101419: epa-file: suppress file-locking question on M-x revert-buffer
Date: Mon, 13 Sep 2010 19:44:07 +0900
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101419
committer: Daiki Ueno <address@hidden>
branch nick: trunk
timestamp: Mon 2010-09-13 19:44:07 +0900
message:
  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)
modified:
  lisp/ChangeLog
  lisp/epa-file.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-09-13 04:39:36 +0000
+++ b/lisp/ChangeLog    2010-09-13 10:44:07 +0000
@@ -1,3 +1,8 @@
+2010-09-13  Daiki Ueno  <address@hidden>
+
+       * 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  <address@hidden>
 
        * notifications.el (notifications-notify): Add support for

=== modified file 'lisp/epa-file.el'
--- a/lisp/epa-file.el  2010-08-29 16:17:13 +0000
+++ b/lisp/epa-file.el  2010-09-13 10:44:07 +0000
@@ -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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]