windows 修复以在 emacs 中平滑滚动?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3631220/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fix to get smooth scrolling in emacs?
提问by Herbert Sitz
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.
我发现自己想要使用 Emacs,主要是因为 org-mode,但是我很难适应生涩的滚动行为。我知道这是 Emacs 的一个众所周知的问题/怪癖,并且有多种方法可以最大程度地减少滚动时的抖动。但到目前为止我尝试过的任何东西都没有效果。
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.
我看到的主要建议是 (setq scroll-conservatively 10000) 或使用 smooth-scrolling.el 中可用的更全面的修复。我认为这两种方法对我来说都可以正常工作,但是当我按住向上箭头和向下箭头键重复向上或向下滚动时,它们都会失败。当我这样做时,屏幕冻结,我看到滚动边距中的滚动指示器栏向上或向下移动。在我停止按住向上箭头或向下箭头键之前,屏幕不会刷新。
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.
如果我反复按向上箭头或向下箭头,那么我的行为就会接近我想要的,即屏幕平滑滚动并且光标键不会重置到屏幕中间。但这是不可取的,因为 (1) 它需要重复按键和 (2) 我认为滚动的速度比我应该能够获得更好的解决方案的速度要慢。
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.
在我看来,按住光标键的问题是向上箭头或向下箭头的重复率太快,以至于触发 emacs 停止屏幕刷新,直到释放键为止。我想知道对我来说可能的解决方法是在键重复率或 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.
更新:上述行为是我在 Win7/64 上运行 emacs 时得到的。在同一台机器上,当我在运行 Ubuntu 10.04 的 VirtualBox VM 中运行 emacs 时,即使按住光标键,滚动也能正常工作。
回答by Ken Goh
I had the same problem! Tried all the scroll-* settings, didn't help when holding down arrow. But found this on gnu.emacs.helpwhich finally worked (for me at least):
我有同样的问题!尝试了所有 scroll-* 设置,在按住箭头时没有帮助。但是在gnu.emacs.help上发现了这个,它终于奏效了(至少对我来说):
(setq redisplay-dont-pause t)
(setq redisplay-dont-pause t)
This is what I have in .emacs for now:
这是我现在在 .emacs 中的内容:
(setq redisplay-dont-pause t
scroll-margin 1
scroll-step 1
scroll-conservatively 10000
scroll-preserve-screen-position 1)
回答by R. P. Dillon
scroll-conservatively
helps, but I also like a margin so that I can see what's coming up as a scroll -- it keeps context on the screen for me. These settings have worked well for me an a wide variety of computers for a few years:
scroll-conservatively
有帮助,但我也喜欢边距,这样我就可以看到滚动的内容——它为我在屏幕上保留上下文。几年来,这些设置对我来说在各种计算机上都运行良好:
(setq scroll-conservatively 10)
(setq scroll-margin 7)
回答by seagle0128
Try this:
尝试这个:
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ; one line at a time
(setq mouse-wheel-progressive-speed nil) ; don't accelerate scrolling
(setq-default smooth-scroll-margin 0)
(setq scroll-step 1
scroll-margin 1
scroll-conservatively 100000)
And use pager.el.
并使用 pager.el。
;; Pager
(require 'pager-default-keybindings)
That's what I want :) Enjoy!
这就是我想要的 :) 享受!
回答by ideasman42
Note that this isn't mentioned anywhere here, but I found for larger files I ended up running into some irritating lag, where scrolling would get behind font updating.
请注意,这里没有提到这一点,但我发现对于较大的文件,我最终遇到了一些恼人的延迟,滚动会落后于字体更新。
This relies on redrawing not being soslow that the system gets too far behind in its updating.
这依赖于重绘不是这么慢,系统过于落后于它的更新。
See this questionfor details.
有关详细信息,请参阅此问题。
These settings worked well for me:
这些设置对我来说效果很好:
(setq
scroll-conservatively 1000 ;; only 'jump' when moving this far
scroll-margin 4 ;; scroll N lines to screen edge
scroll-step 1 ;; keyboard scroll one line at a time
mouse-wheel-scroll-amount '(6 ((shift) . 1)) ;; mouse scroll N lines
mouse-wheel-progressive-speed nil ;; don't accelerate scrolling
redisplay-dont-pause t ;; don't pause display on input
;; Always redraw immediately when scrolling,
;; more responsive and doesn't hang!
fast-but-imprecise-scrolling nil
jit-lock-defer-time 0
)
回答by Jér?me Radix
This behavior is not encountered on all platforms. For those platforms that pose problem, I would recommend to use this setting :
并非在所有平台上都会遇到此行为。对于那些造成问题的平台,我建议使用此设置:
(setq scroll-conservatively 0)
It places the cursor on the middle of the screen each time you scroll to another page.
每次滚动到另一页时,它会将光标放在屏幕中间。
回答by Thomas Kappler
I'm very happy with Adam Spiers' smooth-scrolling, as rpdillon suggested. I thought it deserves an answer of its own.
正如 rpdillon 所建议的那样,我对 Adam Spiers 的平滑滚动感到非常满意。我认为它应该得到自己的答案。
回答by ychaouche
I can scroll by only one line with M-Up / M-Down by adding this to my .emacs :
通过将其添加到我的 .emacs 中,我只能使用 M-Up / M-Down 滚动一行:
(global-set-key (kbd "M-<down>") (lambda () (interactive) (scroll-up 1)))
(global-set-key (kbd "M-<up>") (lambda () (interactive) (scroll-down 1)))