bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#29846: scroll and fontify takes longer time for file in slow network


From: Stefan Monnier
Subject: bug#29846: scroll and fontify takes longer time for file in slow network
Date: Wed, 27 Dec 2017 15:49:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> I have remote drive (//server/path) mapped to my windows system (samba?).
> The network is slow, and it takes some time to open the file. However,
> after I have the file opened and scroll down, it takes a long time to
> scroll to the next screen. It gets worse if the jit-lock-debug-mode is on.
> After that if I try to scroll back to those has been fontified, it get
> fluent as expected.

I believe this bug was introduced by yours truly
in commit 6bc76cee212aab0a2c02f8c28213fc842cc7880f:

  Author: Stefan Monnier <address@hidden>
  Date:   Tue Apr 8 21:48:07 2014 -0400

    * src/insdel.c (prepare_to_modify_buffer_1): Cancel lock-file checks and
    region handling (and don't call signal_before_change) if
    inhibit_modification_hooks is set.
    (signal_before_change): Don't check inhibit_modification_hooks any more.
    * lisp/subr.el (with-silent-modifications): Don't bind deactivate-mark,
    buffer-file-name, and buffer-file-truename any more.

And I think the patch below hence belongs in emacs-26.  Any objection?


        Stefan


diff --git a/src/buffer.c b/src/buffer.c
index 75cb470af8..f518e72f9e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1346,7 +1346,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.  */
@@ -1355,15 +1354,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]