File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 5757 :type 'boolean
5858 :group 'auto-scroll-bar )
5959
60+ (defcustom auto-scroll-bar-delay 0.2
61+ " Time to update scroll-bars state."
62+ :type 'float
63+ :group 'auto-scroll-bar )
64+
65+ (defvar auto-scroll-bar--timer nil
66+ " Timer to do the show/hide task." )
67+
6068; ;
6169; ; (@* "Util" )
6270; ;
127135 (show-h (auto-scroll-bar--show-h-p)))
128136 (auto-scroll-bar--update win show-v show-h)))))
129137
130- (defun auto-scroll-bar--change ( &rest _ )
131- " Window state change. "
138+ (defun auto-scroll-bar--start-task ( )
139+ " "
132140 (auto-scroll-bar--with-no-redisplay
133141 (dolist (win (window-list )) (auto-scroll-bar--show-hide win))))
134142
143+ (defun auto-scroll-bar--change (&rest _ )
144+ " Window state change."
145+ (when (timerp auto-scroll-bar--timer) (cancel-timer auto-scroll-bar--timer))
146+ (setq auto-scroll-bar--timer
147+ (run-with-idle-timer auto-scroll-bar-delay nil #'auto-scroll-bar--start-task )))
148+
135149(defun auto-scroll-bar--enable ()
136150 " Enable function `auto-scroll-bar-mode' ."
137151 (add-hook 'post-command-hook #'auto-scroll-bar--change ) ; post command, less buggy
You can’t perform that action at this time.
0 commit comments