define scroll-mode via use-package

This commit is contained in:
2025-06-18 16:18:40 +02:00
parent 97e7d3c881
commit 20d612c301

View File

@@ -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 #<window 3 on gui-settings.el> 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 #<window 3 on gui-settings.el> 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