emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-27 d7a4cea: ; Add a new item to TODO


From: Stefan Monnier
Subject: Re: emacs-27 d7a4cea: ; Add a new item to TODO
Date: Thu, 17 Dec 2020 12:02:52 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> in at every redisplay cycle are record which value is found by
> increasing the counter in the corresponding slot of
> `redisplay--all-windows-cause` and `redisplay--mode-lines-cause`.

For example, in my currently running Emacs session, I see:

redisplay--all-windows-cause:
#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (31 
631 0 205211 2 35619 52 388 19 178))
redisplay--mode-lines-cause:
#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (12 
789 15 29 0 204962 23 644 2 34019 17 18 18 13 14 302 42 563 11 738 32 410 10 
26))

So, in about 200k cases, the "cause" for redisplay was 0 meaning that
Emacs only redisplayed the selected window.  In about 35k cases, the
"cause" was 2, meaning that Emacs considered more than just the selected
frame, but did not consider all windows&frames (instead it only
considered those windows&frames with the `redisplay` bit set).

Of the remaining cases (where it did consider all windows&frames), 631
were due to "windows_or_buffers_changed == 31" which

    grep windows_or_buffers_changed.\*31 src/*.c

shows is due to a call to `set_window_scroll_bars`.
And 789 were due to update_mode_lines == 12 which comes from
kill-all-local-variables.

Both of those cases seem easy to fix with the patch below which I just
pushed to master.

Of course, as more and more code uses `[fbw]set_redisplay` instead of
just setting `windows_or_buffers_changed`, those two above
`redisplay--*-cause` variables lose some of their usefulness, because
when the cause is 2 we may still be redisplaying too much.


        Stefan


diff --git a/src/buffer.c b/src/buffer.c
index 4215acbf1d..dfc34faf6e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2814,7 +2814,7 @@ DEFUN ("kill-all-local-variables", 
Fkill_all_local_variables,
 
   /* Force mode-line redisplay.  Useful here because all major mode
      commands call this function.  */
-  update_mode_lines = 12;
+  bset_update_mode_line (current_buffer);
 
   return Qnil;
 }
diff --git a/src/window.c b/src/window.c
index 4eab786958..bcc989b5a7 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7822,7 +7822,7 @@ set_window_scroll_bars (struct window *w, Lisp_Object 
width,
         if more than a single window needs to be considered, see
         redisplay_internal.  */
       if (changed)
-       windows_or_buffers_changed = 31;
+       wset_redisplay (w);
 
       return changed ? w : NULL;
     }




reply via email to

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