[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62676: Setting `scroll-bar-width` Doesn't Take Effect Immediately
From: |
Eli Zaretskii |
Subject: |
bug#62676: Setting `scroll-bar-width` Doesn't Take Effect Immediately |
Date: |
Wed, 05 Apr 2023 12:02:25 +0300 |
tags 62676 notabug
thank
> From: Shynur Xie <one.last.kiss@outlook.com>
> Date: Wed, 5 Apr 2023 08:18:00 +0000
>
> Example:
>
> ```
> $ emacs -Q
> ```
>
> Now the current buffer is "*scratch*", evaluating:
>
> ```
> (setq scroll-bar-width 50)
> ```
>
> changes nothing.
>
> Instead, user need to switch to another buffer and then switch back:
>
> ```
> (progn
> (setq scroll-bar-width 50)
> (switch-to-buffer "*Messages*")
> (switch-to-buffer "*scratch*"))
> ```
This is the expected and documented behavior. From the ELisp
Reference manual:
If you do not specify a window’s scroll bar settings via
‘set-window-scroll-bars’, the buffer-local variables
‘vertical-scroll-bar’, ‘horizontal-scroll-bar’, ‘scroll-bar-width’ and
‘scroll-bar-height’ in the buffer being displayed control the window’s
scroll bars. The function ‘set-window-buffer’ examines these variables.
If you change them in a buffer that is already visible in a window, you
can make the window take note of the new values by calling
‘set-window-buffer’ specifying the same buffer that is already
displayed.
Your last recipe calls set-window-buffer indirectly, so it succeeds
where the original recipe failed.