3

As the subject title says, has anyone any suggestions for how to achieve smooth scrolling of the text display in emacs?

The various approaches suggested on the Emacs wiki seem to work only in Linux. I'm using EmacsW32 for what it matters, but I tested with the standard Emacs distribution as well, with no results.

As a long time Vim user, I'm fairly surprised that Emacs cannot scroll smoothly by itself.

3

As a long time emacs user, I rarely think to use my mouse's wheel for scrolling... however, others have. There's a page on smooth scrolling on the emacs wiki.

Update: I found a better answer on the NextLineBehavior page: "Change scroll-conservatively to 1 or other suitably small number, not zero."

5
  • Well, I didn't mean with my mouse either. Just standard Ctrl-N or the arrow down key on your keyboard. But as I mentioned, the wiki stuff doesn't work for Windows at all (well the upwards direction is semi-tolerable, downwards not at all)
    – Svend
    Apr 26 '10 at 19:36
  • 2
    Interesting stuff. I must be so used to the standard emacs behavior that I never noticed that it doesn't scroll a line at a time. This is emacs, however, there must be a way to customize this. Apr 26 '10 at 19:40
  • Sadly, neither solutions offered on that page does anything in Windows (might work on Linux, didn't test). It works when I just press downwards once, but if I keep it down, the screen does not update until I let go (well the scroll does move...), which is clearly not really useful at all.
    – Svend
    Apr 26 '10 at 20:16
  • I'm new to Emacs and almost always use scrolling. How do you usually jump to specific bits of code you need to adjust?
    – Dante
    Sep 14 '12 at 7:57
  • Most frequently by incremental search (C-s / C-r) next by big navigation commands (C-v/M-v) and then using per-line or per-word jumps. Sep 14 '12 at 18:41
0

In my searching I found this:

(setq default-truncate-lines t)
(defun point-of-beginning-of-bottom-line ()
  (save-excursion
    (move-to-window-line -1)
    (point)))

(defun point-of-beginning-of-line ()
  (save-excursion
    (beginning-of-line)
    (point)))

(defun next-one-line () (interactive)
  (if (= (point-of-beginning-of-bottom-line) (point-of-beginning-of-line))
      (progn (scroll-up 1)
             (next-line 1))
    (next-line 1)))

(defun point-of-beginning-of-top-line ()
  (save-excursion
    (move-to-window-line 0)
    (point)))

(defun previous-one-line () (interactive)
  (if (= (point-of-beginning-of-top-line) (point-of-beginning-of-line))
      (progn (scroll-down 1)
             (previous-line 1))
    (previous-line 1)))

(global-set-key (kbd "<down>") 'next-one-line)
(global-set-key (kbd "<up>") 'previous-one-line)

Which sort of helped me in aquamacs and mac os x. Maybe can be useful for WIN as well.

I took it from the emacs' wiki

0

Not exactly sure what you mean by smooth scrolling.. but this is what I use:

(global-set-key [(meta up)] '(lambda(amount) (interactive "p") (scroll-up amount)))
(global-set-key [(meta down)] '(lambda(amount) (interactive "p") (scroll-down amount)))

This works fine for me with the regular GNU win32 emacs build.

0
 ;;; scrollers
 (global-set-key "\M-n" '"\C-u1\C-v")
 (global-set-key "\M-p" '"\C-u1\M-v")

I use this for scrolling. I remember I have copied this from SO only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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