From 02abd6dbf8b8d1866e769c411acbee74a9f3e0bd Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 2 Jan 2021 10:03:20 -0600 Subject: Preserve the point position on screen when scrolling --- config.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'config.org') diff --git a/config.org b/config.org index aa187c0..d7b10f9 100644 --- a/config.org +++ b/config.org @@ -662,6 +662,22 @@ Anyway, I should probably be able to figure out how to properly change the theme (run-hooks 'acdw/map-defined-hook) #+END_SRC +** Mouse + +*** Preserve screen position when scrolling with the mouse wheel + +from [[https://www.reddit.com/r/emacs/comments/km9by4/weekly_tipstricketc_thread/ghg2c9d/][u/TheFrenchPoulp]]. + +#+BEGIN_SRC emacs-lisp + (advice-add 'mwheel-scroll :around #'me/mwheel-scroll) + + (defun me/mwheel-scroll (original &rest arguments) + "Like `mwheel-scroll' but preserve screen position. + See `scroll-preserve-screen-position'." + (let ((scroll-preserve-screen-position :always)) + (apply original arguments))) +#+end_src + ** Persistence *** Minibuffer history -- cgit 1.4.1-21-gabe81