emacs-diffs
[Top][All Lists]
Advanced

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

master 8f69483: Avoid extra "changed on disk" prompt in save-buffer (Bug


From: Noam Postavsky
Subject: master 8f69483: Avoid extra "changed on disk" prompt in save-buffer (Bug#18336)
Date: Sun, 22 Mar 2020 23:25:58 -0400 (EDT)

branch: master
commit 8f694831c04b1fb9db81be72afdc1a1101d619c4
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Avoid extra "changed on disk" prompt in save-buffer (Bug#18336)
    
    * src/filelock.c (lock_file): Don't query the user if the current
    session already owns the lock.
---
 src/filelock.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/filelock.c b/src/filelock.c
index 73202f0..2b734ee 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -680,6 +680,9 @@ lock_file (Lisp_Object fn)
   dostounix_filename (SSDATA (fn));
 #endif
   encoded_fn = ENCODE_FILE (fn);
+  if (create_lockfiles)
+    /* Create the name of the lock-file for file fn */
+    MAKE_LOCK_NAME (lfname, encoded_fn);
 
   /* See if this file is visited and has changed on disk since it was
      visited.  */
@@ -690,7 +693,8 @@ lock_file (Lisp_Object fn)
 
     if (!NILP (subject_buf)
        && NILP (Fverify_visited_file_modtime (subject_buf))
-       && !NILP (Ffile_exists_p (fn)))
+        && !NILP (Ffile_exists_p (fn))
+        && (!create_lockfiles || current_lock_owner (NULL, lfname) != -2))
       call1 (intern ("userlock--ask-user-about-supersession-threat"), fn);
 
   }
@@ -698,10 +702,6 @@ lock_file (Lisp_Object fn)
   /* Don't do locking if the user has opted out.  */
   if (create_lockfiles)
     {
-
-      /* Create the name of the lock-file for file fn */
-      MAKE_LOCK_NAME (lfname, encoded_fn);
-
       /* Try to lock the lock.  FIXME: This ignores errors when
         lock_if_free returns a positive errno value.  */
       if (lock_if_free (&lock_info, lfname) < 0)



reply via email to

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