emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 e879a54: * src/buffer.c (Frestore_buffer_modified


From: Stefan Monnier
Subject: [Emacs-diffs] emacs-26 e879a54: * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846
Date: Thu, 28 Dec 2017 14:03:12 -0500 (EST)

branch: emacs-26
commit e879a5444a86e8fc030bbef69fbb8d84e9961fa3
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846
    
    Don't mess with the lock file when inhibit_modification_hooks is set,
    just like we do in prepare_to_modify_buffer_1.
---
 src/buffer.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/buffer.c b/src/buffer.c
index bcde2c8..7ed21f0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1354,7 +1354,6 @@ It is not ensured that mode lines will be updated to show 
the modified
 state of the current buffer.  Use with care.  */)
   (Lisp_Object flag)
 {
-  Lisp_Object fn;
 
   /* If buffer becoming modified, lock the file.
      If buffer becoming unmodified, unlock the file.  */
@@ -1363,15 +1362,18 @@ state of the current buffer.  Use with care.  */)
     ? current_buffer->base_buffer
     : current_buffer;
 
-  fn = BVAR (b, file_truename);
-  /* Test buffer-file-name so that binding it to nil is effective.  */
-  if (!NILP (fn) && ! NILP (BVAR (b, filename)))
+  if (!inhibit_modification_hooks)
     {
-      bool already = SAVE_MODIFF < MODIFF;
-      if (!already && !NILP (flag))
-       lock_file (fn);
-      else if (already && NILP (flag))
-       unlock_file (fn);
+      Lisp_Object fn = BVAR (b, file_truename);
+      /* Test buffer-file-name so that binding it to nil is effective.  */
+      if (!NILP (fn) && ! NILP (BVAR (b, filename)))
+        {
+          bool already = SAVE_MODIFF < MODIFF;
+          if (!already && !NILP (flag))
+           lock_file (fn);
+          else if (already && NILP (flag))
+           unlock_file (fn);
+        }
     }
 
   /* Here we have a problem.  SAVE_MODIFF is used here to encode



reply via email to

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