From 20d612c3017157b4253cd33203eadad4aea52574 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Wed, 18 Jun 2025 16:18:40 +0200 Subject: [PATCH] define scroll-mode via use-package --- settings/gui-settings.el | 52 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/settings/gui-settings.el b/settings/gui-settings.el index 96e7eaf0..24d51855 100644 --- a/settings/gui-settings.el +++ b/settings/gui-settings.el @@ -41,31 +41,7 @@ (help-mode . visual-line-mode) (messages-buffer-mode . visual-line-mode) :config - (set-face-attribute 'fill-column-indicator nil :foreground "DarkSlateGray") ;; inherit shadow - - ;; `scroll-bar-mode' sets for all frames and all windows - ;; use `set-window-scroll-bars' for windows only - (scroll-bar-mode 0) ;; 1st deactivate scrolling - (defun my-window-scroll-function (window display-start) - "This function -- is listed in `window-scroll-functions' which is called by - `set-window-buffer' before running `window-configuration-change-hook' - and therefore will be run on every vertical scroll event -- will activate vertical scoll bar if not whole buffer height is - visible - -WINDOW: `window' object, its string will look like # and -DISPLAY-START: `integer', e.g. 3820" - ;; (message "%s" window) - (let ((vertical-type nil) - (horizontal-type nil)) - (unless (string-equal (format-mode-line "%p") "All") - (setq vertical-type 'right)) - ;; `scroll-bar-mode' not used bc/ it's global, therefore: - (set-window-scroll-bars - window nil vertical-type nil horizontal-type nil))) - (add-to-list 'window-scroll-functions #'my-window-scroll-function) - ) ;; end of use-package emacs + (set-face-attribute 'fill-column-indicator nil :foreground "DarkSlateGray")) ;; inherit shadow ;; ┌────────────── Frame width ───────────────┐ @@ -103,6 +79,32 @@ DISPLAY-START: `integer', e.g. 3820" (setq window-divider-default-places 'right-only) (window-divider-mode 1)) +(use-package scroll-bar + :defer t + :config + ;; `scroll-bar-mode' sets for all frames and all windows + ;; use `set-window-scroll-bars' for windows only + (scroll-bar-mode 0) ;; 1st deactivate scrolling + (defun my-window-scroll-function (window display-start) + "This function +- is listed in `window-scroll-functions' which is called by + `set-window-buffer' before running `window-configuration-change-hook' + and therefore will be run on every vertical scroll event +- will activate vertical scoll bar if not whole buffer height is + visible + +WINDOW: `window' object, its string will look like # and +DISPLAY-START: `integer', e.g. 3820" + ;; (message "%s" window) + (let ((vertical-type nil) + (horizontal-type nil)) + (unless (string-equal (format-mode-line "%p") "All") + (setq vertical-type 'right)) + ;; `scroll-bar-mode' not used bc/ it's global, therefore: + (set-window-scroll-bars + window nil vertical-type nil horizontal-type nil))) + (add-to-list 'window-scroll-functions #'my-window-scroll-function)) + (use-package tab-bar :defer 0.5 :bind ((:map global-map