reddit / emacs

Emacs 29.1 Stuttery scrolling with (pixel-scroll-precision-mode)

BlackberryPerfect938 · 2022-09-15 05:44
I sometimes want to use my touchpad to scroll though my code, especially when i want to show it to someone else. [Left: firefox browser scrolling | Right: emacs scrolling](https://i.redd.it/2v8dltxnmyn91.gif) To prove that that my touchpad is not faulty i'm showing normal scrolling behavior in left window Strange thing is that scrolling seems ok at a start, but i use emacs a bit more, it starts to be stuttery. I did try to use emacs -q, the stuttering still exists.
funk443 · 2022-09-15 05:46
I thought emacs 29 is still under development, right? So it might become better in the future.
BlackberryPerfect938 · 2022-09-15 05:50
Yea, true. but i remember using some older 29v commit about 2 months ago, i didn't have any problems with scrolling. With that in mind i recently i tried building older versions, but unfortunately didn't find commit where scrolling works ):
SmirnoffBG · 2022-09-15 06:39
C-v 😀
BlackberryPerfect938 · 2022-09-15 07:15
I use C-v. The issue is when i need to show code to other people, it scrolls too fast with big jumps, so the can't follow my code
TheFrenchPoulp · 2022-09-15 08:30
I know this is not what you want to hear, but I would give up the quest for scrolling to get as smooth as other applications with much less technical implications wrt/ pixel-based scroll During sessions with people watching my editor, I started to rely on pulsating faces to help the spectator (and me!) follow the point. I can recommend https://protesilaos.com/emacs/pulsar as a way to have that kind of feature with sane defaults but without having to configure anything yourself
jimehgeek · 2022-09-15 08:42
It sounds like you’re having the same issue as reported in this bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51886 It might also explain why I haven’t seen this issue, as I use [gcmh](https://gitlab.com/koral/gcmh) in my config to avoid garbage collection while I’m actively interacting with emacs. I’d say maybe try gcmh and see if it makes a difference. For reference, [here](https://github.com/jimeh/.emacs.d/blob/06bf89af61413aaf610e7a293306c01e330f3302/core/siren-core-performance.el) is my setup of it.
alcanost · 2022-09-15 09:34
> i recently i tried building older versions, but unfortunately didn't find commit where scrolling works ): I know it may sound a bit “just do it lol”, but have you tried using [`git bisect`](https://www.git-tower.com/learn/git/faq/git-bisect/) from a working commit of 2 months ago to narrow down the buggy commit?
flaviusmaximus7 · 2022-09-15 15:21
Really cool config, I'm gonna use it to learn more about elisp and how to organize my config, thanks!
jimehgeek · 2022-09-15 16:23
Thanks :)… it was originally heavily inspired by [Emacs Prelude](https://github.com/bbatsov/prelude), but has since drifted quite far from it. I’d be happy to answer any questions you might have :) I’m reasonably happy with my config now a days. Between 2011-2015 I rewrote it from scratch four times. The current rewrite has survived since 2015, but with some pretty drastic refactors along the way.
BlackberryPerfect938 · 2022-09-15 16:37
No i didn't even know that functionality existed. That's awesome!
soundslogical · 2022-09-16 07:24
Agreed. I've had success with [beacon-mode](https://github.com/Malabarba/beacon) for the same purpose. Making C-v and M-v scroll by half pages also helps. (use-package beacon :config (beacon-mode 1) :custom (beacon-color "#aa7700")) (setq next-screen-context-lines 2) (setq scroll-preserve-screen-position t) (setq scroll-error-top-bottom t) ; DON'T error at top (confusing name!) (global-set-key (kbd "C-v") 'my:scroll-half-page-forward) (global-set-key (kbd "M-v") 'my:scroll-half-page-backward) (defun my:line-number-at-pos (pos) "A faster version of line-number-at-pos" (save-excursion (goto-char pos) (string-to-number (format-mode-line "%l")))) (defun my:indicate-scroll-to-line (to-line) (let* ((pulse-delay 0.15) (last-line (my:line-number-at-pos (point-max))) (curr-line (my:line-number-at-pos (point))) (h (window-text-height)) (direction (if (> to-line curr-line) 1 -1)) (num-to-scroll (* direction (round (* h 0.7))))) (save-excursion (goto-line to-line) (beacon--shine) (sit-for pulse-delay)) (when (> (abs (- to-line last-line)) (+ 1 next-screen-context-lines)) (scroll-up-command num-to-scroll)) (goto-line to-line) (beacon--vanish))) (defun my:scroll-half-page-forward () (interactive) (my:indicate-scroll-to-line (- (my:line-number-at-pos (1- (window-end))) next-screen-context-lines))) (defun my:scroll-half-page-backward () (interactive) (my:indicate-scroll-to-line (+ (my:line-number-at-pos (window-start)) next-screen-context-lines)))