Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fix to get smooth scrolling in emacs?

Tags:

emacs

windows

I find myself wanting to use Emacs, mostly because of org-mode, but I'm having a lot of trouble getting used to the jerky scrolling behavior. I know this is a well-known problem/eccentricity of Emacs and that there are various ways to minimize jerkiness when scrolling. But nothing I've tried so far works very well at all.

The main suggestions I've seen are (setq scroll-conservatively 10000) or to use the more comprehensive fix available in smooth-scrolling.el . I think both of these might work okay for me, but both fail miserably when I hold down the up-arrow and down-arrow key to get repeated scrolling up or down. When I do this the screen freezes and I see the scroll-indicator-bar in the scroll margin move up or down. The screen does not refresh until I stop holding down the up-arrow or down-arrow key.

If I repeatedly press up-arrow or down-arrow then I do get behavior close to what I want, i.e., the screen scrolls smoothly and cursor key does not get reset to middle of screen. But this is undesirable because (1) it requires repeated keypresses and (2) I assume the scrolling is at a slower rate than what I should be able to get in better solution.

The problem with holding the cursor keys down seems to me to be that the repeat rate of up-arrow or down-arrow is so fast that it triggers emacs to stop the screen refresh until key is released. I wonder whether a possible fix for me would be to add some lag into the key-repeat rate or the rate at which the next/previous line function is called in emacs.

I haven't seen this reported as a problem by others and I wonder whether other people have experienced same behavior. What's best way to fix things so I can hold the up/down arrow keys down and have repeat rate that's slow enough so that the screen doesn't freeze?

UPDATE: The above behavior is what I get when I run emacs on Win7/64. On same machine when I run emacs inside a VirtualBox VM running Ubuntu 10.04 it's no problem to get scrolling that works fine even when cursor keys are held down.

like image 293
Herbert Sitz Avatar asked Sep 02 '10 20:09

Herbert Sitz


People also ask

Is smooth scrolling enabled?

If your Google Chrome seems to be jerky or stuttering when scrolling, you can enable this feature. Open a new tab and type chrome://flags/#smooth-scrolling in the address bar, and press Enter. Click the dropdown box next to Smooth scrolling, and click Enabled. Click Relaunch on the bottom-right corner.

How do I smooth scroll to anchor?

You can use window. scroll() with behavior: smooth and top set to the anchor tag's offset top which ensures that the anchor tag will be at the top of the viewport.

What is smooth scrolling?

With smooth scrolling, it slides down smoothly, so you can see how much it scrolls. This might not be a huge deal for you but it is a big deal for users who read a lot of long pages. The choppy scroll might be annoying for a lot of users and that's why people are moving towards the smooth scroll option.

How do I scroll in Emacs?

There are (of course) lots of ways to scroll the window and move the cursor in emacs. To move the cursor up or down by a line you can use the arrow keys, or C-n and C-p . To scroll the window, you can use C-v and M-v to scroll down or up respectively by nearly one full screen. This is equivalent to page up/down.


1 Answers

I had the same problem! Tried all the scroll-* settings, didn't help when holding down arrow. But found this on gnu.emacs.help which finally worked (for me at least):

(setq redisplay-dont-pause t)

This is what I have in .emacs for now:

(setq redisplay-dont-pause t   scroll-margin 1   scroll-step 1   scroll-conservatively 10000   scroll-preserve-screen-position 1) 
like image 89
Ken Goh Avatar answered Sep 28 '22 03:09

Ken Goh