mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
It sometimes causes a long lock-up of Emacs. I believe this is due to a known issue where the mode can cause excessive garbage collection while scrolling, combined with my use of gcmh which prevents GC while actively using Emacs. Hence my theory is that pixel scrolling is causing tons of memory to be consumed, but gcmh prevents the GC from running, until it hits a tipping point where it GCs hundreds of megabytes of memory. Or, that's my theory at least :P
45 lines
1.6 KiB
EmacsLisp
45 lines
1.6 KiB
EmacsLisp
;;; siren-pixel-scroll.el --- jimeh's Emacs Siren: pixel-scroll.
|
|
|
|
;;; Commentary:
|
|
|
|
;; Enable and configure pixel-scroll-precision-mode on Emacs 29.x and later when
|
|
;; running in a window system.
|
|
|
|
;;; Code:
|
|
|
|
(when (fboundp 'pixel-scroll-precision-mode)
|
|
(use-package pixel-scroll
|
|
:straight (:type built-in)
|
|
:if window-system
|
|
|
|
:preface
|
|
(defvar siren-pixel-scroll--original-scroll-margin scroll-margin)
|
|
(defvar siren-pixel-scroll--original-scroll-preserve-screen-position
|
|
scroll-preserve-screen-position)
|
|
|
|
(define-minor-mode siren-pixel-scroll-mode
|
|
"Enable pixel-scroll-precision-mode with other tweaks."
|
|
:global t
|
|
(if siren-pixel-scroll-mode
|
|
(progn
|
|
(setq pixel-scroll-precision-interpolate-page t)
|
|
(setq pixel-scroll-precision-large-scroll-height 40.0)
|
|
(setq pixel-scroll-precision-interpolation-factor 30)
|
|
(setq pixel-scroll-precision-use-momentum
|
|
(not (eq system-type 'darwin)))
|
|
(setq siren-pixel-scroll--original-scroll-margin scroll-margin)
|
|
(setq scroll-margin 0)
|
|
(setq siren-pixel-scroll--original-scroll-preserve-screen-position
|
|
scroll-preserve-screen-position)
|
|
(setq scroll-preserve-screen-position 'always)
|
|
|
|
(pixel-scroll-precision-mode +1))
|
|
(progn
|
|
(pixel-scroll-precision-mode -1)
|
|
(setq scroll-margin siren-pixel-scroll--original-scroll-margin)
|
|
(setq scroll-preserve-screen-position
|
|
siren-pixel-scroll--original-scroll-preserve-screen-position))))))
|
|
|
|
(provide 'siren-pixel-scroll)
|
|
;;; siren-pixel-scroll.el ends here
|