Subject: Re: bug#33694: 27.0.50; 'set-window-scroll-bars' broken

From: Eli Zaretskii <[email-masked]>
Date: Mon, 10 Dec 2018 11:52:57 +0200

> Date: Mon, 10 Dec 2018 09:41:11 +0100
> From: martin rudalics <[email-masked]>
> Cc: [email-masked]
> 
> This change
> 
> 2015-09-30  Stefan Monnier  <[email-masked]>
> 
> 	Try to avoid redisplaying all frames when creating a new one
> 
> 	...
> 
> 	* src/window.c (apply_window_adjustment): Remove redundant setting of
> 	windows_or_buffers_changed.
> 
>          ...
> 
> broke evaluating the following form with emacs -Q:
> 
> (set-window-scroll-bars nil 0 nil)
> 
> This should immediately remove the scroll bar of the selected window
> but instead hides its right fringe under the scroll bar.

Does the below look reasonable?  I'd like to apply it to the emacs-26
branch.

diff --git a/src/window.c b/src/window.c
index 5d99098..c93ab5c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7254,6 +7254,10 @@ set_window_scroll_bars (struct window *w, Lisp_Object width,
   wset_horizontal_scroll_bar_type (w, Qnil);
 #endif
 
+  /* This is needed to trigger immediate redisplay of the window when
+     scroll bars are changed.  */
+  if (changed)
+    windows_or_buffers_changed = 31;
   return changed ? w : NULL;
 }