;; == Scrolling ================================================================
(use-feature emacs
:custom
;; https://www.masteringemacs.org/article/improving-performance-emacs-display-engine
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Scrolling.html
;; https://www.reddit.com/r/emacs/comments/8sw3r0/finally_scrolling_over_large_images_with_pixel/
;; https://www.reddit.com/r/emacs/comments/9rwb4h/why_does_fast_scrolling_freeze_the_screen/
;; https://emacs.stackexchange.com/questions/10354/smooth-mouse-scroll-for-inline-images
;; https://emacs.stackexchange.com/questions/28736/emacs-pointcursor-movement-lag
;; https://www.emacswiki.org/emacs/InertialScrolling
;; https://www.emacswiki.org/emacs/SmoothScrolling
;; https://github.com/ahungry/fast-scroll
(redisplay-dont-pause t) ;; Fully redraw the display before it processes queued input events.
(next-screen-context-lines 2) ;; Number of lines of continuity to retain when scrolling by full screens
(scroll-margin 3) ;; Scroll N lines to screen edge
(scroll-conservatively 10000) ;; only 'jump' when moving this far off the screen
(scroll-step 1) ;; Keyboard scroll one line at a time
;; Distance in pixel-resolution to scroll each mouse wheel event.
(mouse-wheel-scroll-amount '(6 ((shift) . 1)))
(mouse-wheel-progressive-speed nil) ;; Don't accelerate scrolling
(mouse-wheel-follow-mouse t) ;; Scroll window under mouse
(fast-but-imprecise-scrolling t) ;; No (less) lag while scrolling lots.
(auto-window-vscroll nil) ;; Cursor move faster
)

;; Inertial Scrolling - Better than progressive-speed
(use-package inertial-scroll
:bind
(("<mouse-4>" . inertias-down-wheel)
("<mouse-5>" . inertias-up-wheel )
("<wheel-up>" . inertias-down-wheel)
("<wheel-down>" . inertias-up-wheel )))


Sublimemity 써봤는데 생각보다 별로라

일단 이렇게 쓰고 있음. 관성 스크롤링 패키지가 오래되서 자체적으로 고쳐쓰는 중.

https://github.com/black7375/emacs-inertial-scroll





한라인씩 내리는게 아니라 부드럽게 내려가는 건 원래 pixel scroll mode가 내장

https://github.com/emacs-mirror/emacs/blob/3af9e84ff59811734dcbb5d55e04e1fdb7051e77/lisp/pixel-scroll.el

되어 있는데 구림.

(use-feature pixel-scroll
:custom
(pixel-dead-time 0) ;; Never go back to the old scrolling behaviour.
(pixel-resolution-fine-flag t) ;; Scroll by number of pixels instead of lines (t = frame-char-height pixels).
)

위처럼 하면 그나마 낫다는데도

GCCEMACS여도 버버버ㅓㅓㅓㅓㅓㅓㅓㅓ버거버거벅


내장되었음에도 못 쓸물건이라는게

https://www.reddit.com/r/emacs/comments/dag0ya/does_pixelscrollmode_work/

https://github.com/hlissner/doom-emacs/issues/2482

https://github.com/seagle0128/doom-modeline/issues/199

여기저기에서 드러남.


이 대안이 바로

https://github.com/io12/good-scroll.el

(use-package good-scroll :hook (after-init . good-scroll-mode))

그런데 이것도 내 기준 좀 느린것 같아서..

그냥 첫번째 세팅으로 쓰는 중..

Progressive 대신에 관성 스크롤링 쓰니 정직하면서 자연스러운 느낌?이 들어서 이렇게 쓰는중..

갠적으로 Horizontal Scrolling은 그냥 답이 없다고 생각함.


이맥스 스크롤링이 구린 이유중 하나는 터미널을 에뮬레이션하기 때문아닌가 싶음.



기타 마우스 설정에 도움될만한것?

;; == Keybindings ==============================================================
;; <mouse-1>: Left Button
;; <mouse-2>: Middle Button
;; <mouse-3>: Right Button
;; <mouse-4>: Wheel Up <wheel-up>
;; <mouse-5>: Wheel Down <wheel-down>
;; <mouse-6>: Wheel Right <wheel-right>
;; <mouse-7>: Wheel left <wheel-left>
(use-feature mwheel
:hook
(after-init . mouse-wheel-mode)
:bind
(("C-<mouse-4>" . text-scale-increase)
("C-<mouse-5>" . text-scale-decrease)
("C-<wheel-up>" . text-scale-increase)
("C-<wheel-down>" . text-scale-decrease)

("<mouse-6>" . horizon-right)
("<mouse-7>" . horizon-left )
("<wheel-right>" . horizon-right)
("<wheel-left>" . horizon-left ))
:custom
(mwheel-scroll-up-function 'mwheel-scroll-all-scroll-up-all )
(mwheel-scroll-down-function 'mwheel-scroll-all-scroll-down-all)

:functions mwheel-scroll-all-function-all
:init
;; == Touchpad Horizontal ============
(defun horizon-right ()
(interactive)
(if truncate-lines (scroll-right 1)))
(defun horizon-left ()
(interactive
(if truncate-lines (scroll-left 1))))

;; == Scroll All Mode ================
(defun mwheel-scroll-all-function-all (func &optional arg)
"Scroll multiple buffers together. - with 'scroll-all-mode'"
(if (and scroll-all-mode arg)
(save-selected-window
(walk-windows
(lambda (win)
(select-window win)
(condition-case nil
(funcall func arg)
(error nil)))))
(funcall func arg)))

(defun mwheel-scroll-all-scroll-up-all (&optional arg)
(mwheel-scroll-all-function-all 'scroll-up arg))
(defun mwheel-scroll-all-scroll-down-all (&optional arg)
(mwheel-scroll-all-function-all 'scroll-down arg))
)

;; == Context Menu =============================================================
(use-package popup-edit-menu
:commands popup-edit-menu-stub
:bind
(("M-<mouse-3>" . mouse-save-then-kill ) ;; Original <mouse-3>
("C-M-<mouse-3>" . mouse-secondary-save-then-kill) ;; M-<mouse-3>
)
:init
(bind-key "<mouse-3>" (popup-edit-menu-stub))

:custom
(popup-edit-menu-never-menu-bar-flag t)
(popup-edit-menu-mode-menus-down-flag t)

:config
;; Start
(easy-menu-add-item nil '("edit") ["---" nil t])

;; Window menu
(easy-menu-add-item nil '("edit") (list
"Window"
["Split Window Top/Bottom" split-window-below]
["Split Window Left/Right" split-window-right]
["View Only Current Window" delete-other-windows]))

;; Buffer menu
(easy-menu-add-item nil '("edit") (list
"Buffer Tools"
["Buffer List" buffer-menu]
["Recent File List" recentf-open-files ]))

;; Code tools
(easy-menu-add-item nil '("edit") (list
"Coding Utilities"
["Toggle Visual Line Mode" visual-line-mode]
["Toggle Truncate Lines Mode" toggle-truncate-lines]
["Toggle Show Whitespace Chars" whitespace-mode ]))

;; end
(easy-menu-add-item nil '("edit") ["---" nil ])
)

;; == Minibuffer ===============================================================
(use-feature emacs
:hook (mouse-leave-buffer . kill-minibuffer)
:init
(defun kill-minibuffer ()
"Exit the minibuffer if it is active."
(when (and (>= (recursion-depth) 1)
(active-minibuffer-window))
(abort-recursive-edit))))


키맵은 Evil, Emacs, Common, Brief 혼종으로 괴랄하게 쓰는 편이라

도움 안될거임.


이맥스 컨텍스트 메뉴 설정이랑 미니버퍼 탈출 설정은 꽤 유용하지 않나 시프다.