如何理解`(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))`?

How to understand `(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))`?

我从某处复制了这个,一次滚动一行效果很好。

(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time

不过,这里的'(1 ((shift) . 1)我不明白是什么意思。 shift 有什么作用?

与 Emacs 中的任何变量一样,使用 C-hv mouse-wheel-scroll-amount 了解它。

在这种情况下,我看到:

mouse-wheel-scroll-amount is a variable defined in ‘mwheel.el’.
Its value is (5 ((shift) . 1) ((control)))

Documentation:
Amount to scroll windows by when spinning the mouse wheel. This is an alist mapping the modifier key to the amount to scroll when the wheel is moved with the modifier key depressed. Elements of the list have the form (MODIFIERS . AMOUNT) or just AMOUNT if MODIFIERS is nil.

AMOUNT should be the number of lines to scroll, or nil for near full screen. It can also be a floating point number, specifying the fraction of a full screen to scroll. A near full screen is ‘next-screen-context-lines’ less than a full screen.

这有点技术含量,但告诉我当我默认使用鼠标滚轮时,Emacs 会一次滚动 5 行;但是当我按住 shift 时一次只有 1 行;如果我按住 ctrl 然后它会一次滚动接近全屏的东西——因为 ((control))((control) . nil).[= 是一样的16=]

以下行为:

(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))

因此等同于简单的

(setq mouse-wheel-scroll-amount '(1))

在后一种情况下,修改键没有覆盖。