【发布时间】:2016-10-15 14:26:29
【问题描述】:
默认行为是 Emacs 将最后一行滚动到框架的中心。使用鼠标滚动时如何将最后一行保持在框架的底部?
【问题讨论】:
默认行为是 Emacs 将最后一行滚动到框架的中心。使用鼠标滚动时如何将最后一行保持在框架的底部?
【问题讨论】:
(setq scroll-conservatively 101)
这是来自*Help* 窗口的信息,由describe-variable 生成:
scroll-conservatively is a variable defined in `C source code'.
Its value is 101
Original value was 0
Documentation:
Scroll up to this many lines, to bring point back on screen.
If point moves off-screen, redisplay will scroll by up to
‘scroll-conservatively’ lines in order to bring point just barely
onto the screen again. If that cannot be done, then redisplay
recenters point as usual.
If the value is greater than 100, redisplay will never recenter point,
but will always scroll just enough text to bring point into view, even
if you move far away.
A value of zero means always recenter point if it moves off screen.
You can customize this variable.
【讨论】:
emacs -q。大多数人从互联网上复制一堆处理scroll-step 的东西,他们将scroll-conservatively 设置为数万亿亿,但这些都不是必需的。无需用户配置,只需这一行。 (setq scroll-conservatively 101) 一旦你验证它与emacs -q 一起工作,你就可以在你的用户配置中追踪冲突。不需要像scroll-up-aggressively 或scroll-down-aggressively 或auto-window-vscroll 这样的东西;没有必要玩scroll-margin——没有那些东西。
emacs -q——即尝试不使用用户配置——只需使用(setq scroll-conservatively 101) 的那一行,看看会发生什么。您可能还希望添加:(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil))),这样鼠标滚轮一次只能滚动一行,而不是默认的一次滚动 5 行。
emacs -q 开头后评估了(setq scroll-conservatively 101),如上一条评论中所示(例如,M-x eval-expression),仍然没有得到想要的结果,那么请考虑花费一些是时候编辑您的问题,为每个人提供可重现的配方,并更好地描述您正在经历的事情。阅读此主题的任何人都应该能够在没有用户配置的情况下启动 Emacs,并复制您遇到的确切行为,以便我们了解问题并提出潜在的解决方案。