I am able to scroll using navigation buttons and external mouse on a Mac with this code that keeps the cursor at a specific line at all times. I am using this code since it is much faster than centered-cursor-mode.
The only problem I am facing is when using the macbook mouse which is mapped to "mac-mwheel-scroll". When using it, the buffer stalls and the cursor doesn't move at all. Any help to figure a solution out is appreciated.
(defcustom centered-point-position 0.35 "Percentage of screen where `centered-point-mode' keeps point." :type 'float) (setq centered-point--preserve-pos nil) (define-minor-mode centered-point-mode "Keep the cursor at `centered-point-position' in the window" :lighter " centerpoint" (cond (centered-point-mode (add-hook 'post-command-hook 'center-point nil t) (setq centered-point--preserve-pos scroll-preserve-screen-position) (setq-local scroll-preserve-screen-position 'all)) (t (remove-hook 'post-command-hook 'center-point t) (setq-local scroll-preserve-screen-position centered-point--preserve-pos)))) (defun center-point () "Move point to the line at `centered-point-position'." (interactive) (when (eq (current-buffer) (window-buffer)) (let ((recenter-positions (list centered-point-position))) (recenter-top-bottom)))) (defun centered-point-mode-on () (centered-point-mode 1)) (define-globalized-minor-mode global-centered-point-mode centered-point-mode centered-point-mode-on)