7

With GNU Emacs 26.1 installing either smooth scroll while adding

(require 'smooth-scroll)
(smooth-scroll-mode t)

to my .emacs, or smooth scrolling with

(require 'smooth-scrolling)
(smooth-scrolling-mode 1)

does turn on the smooth scrolling mode just fine, but two-finger vertical swipes on the trackpad do not deliver the purported smooth scrolling.

Switching to Yamamoto Mitsuharu's Emacs is a bit too much for just this one nice feature. I'd rather stick to a package.

Did you manage to get either of these two packages to smooth scroll with 26.1 or a recent version of Emacs?

By "smooth scroll" here I mean that one would get the scrolling obtained with, say, Safari (with files whose length exceeds that of the window/frame).

Update

The discussions online

are inherently confused. Missing in the middle of the questions/conversations is a definition of "line" in the expression "smooth scrolling by line". One solution is to qualify that term by replacing it with either "character-line" or "pixel-line". The present question is about the latter.

7
  • An implementation in Lisp of what could/should be done in C, is not going to be the best approach. To the extent that Mitsuharu does something better in C, then that would probably be better than vanilla Emacs with a Lisp attempted fix. If you are partial to staying with the vanilla Emacs, try (setq scroll-conservatively 101) and set the mouse / trackpad wheel scroll (within Emacs) to just one line at a time and try that. Forget about the other settings in the interim until you have fully explored that option, then play with other settings to your heart's content. You can type C-h v ..
    – lawlist
    Commented Oct 2, 2018 at 4:46
  • @lawlist Understood. But using C before even seeing whether the Lisp-side speed is adequate is a bit of premature optimization. The more critical issue is to see that it's doable at all using an elisp package. What API is Apple exposing? If that API is suitable, perhaps a modern CPU that is otherwise sitting idle will allow an Emacs buffer to scroll nicely.
    – Calaf
    Commented Oct 2, 2018 at 11:22
  • 1
    When you say that it should be like Safari, do you mean pixel scrolling, where it scrolls by less than the height of a line of text at a time? That's enabled with pixel-scroll-mode, though I don't know off-hand what events it responds to. It doesn't pixel scroll for page up or page down, for instance. smooth-scrolling-mode does subtly change the page up/page down behavior though, so perhaps you just need to be more precise about describing what you want?
    – db48x
    Commented Oct 2, 2018 at 15:52
  • @db48x Pretty simple, really. Start Emacs with no init file. Load a large text file. Double-swipe vertically. The bufer scrolls by pixel increments, not by text line (character) increments. It's much more pleasant on the eye, especially if you're going back and forth scrolling a program (yes, I'm aware of 'follow-mode' and split vertically, use a large screen, write brief blocks, etc... still..).
    – Calaf
    Commented Oct 3, 2018 at 23:48
  • 1
    @db48x pixel-scroll-mode is what I was looking for. Please add it as an answer, possibly while also telling everyone what the smooth-scrolling mode does (now that I see what they mean there by "line", I'm puzzled that this requires a package, since it's easy to set the variables without an extra package). A comment to readers who drop in here about the usability of pixel-scroll-mode: it's not quite as nice as one would want. The distraction of the final slowdown to stop at a character-line boundary just about ruins it--almost nullifying any niceness of the smooth-scrolling. (cont.)
    – Calaf
    Commented Oct 4, 2018 at 10:42

2 Answers 2

8

M-x pixel-scroll-mode, available since Emacs 26, is all that's needed to have pixel scrolling. Credit to @db48x

3
2

You may also try good-scrool.el, a library which offers pixel scrolling like pixel-scroll-mode, but supports dynamic scrolling speed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.