Emacsでマウスホイールでのスクロール時、1行ずつにする以下のスクリプトはどう解釈したら良いのでしょうか。setq
はわかるので大丈夫です。
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
スタック・オーバーフローはプログラマーとプログラミングに熱心な人のためのQ&Aサイトです。すぐ登録できます。
登録してこのコミュニティに参加するmouse-wheel-scroll-amount
のドキュメンテーションでは以下の様になっています。
mouse-wheel-scroll-amount is a variable defined in
‘mwheel.el’
.
Its value is(5 ((shift) . 1) ((control)))
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 は version 25.2(開発版のスナップショット)で、mouse-wheel-scroll-amount
のデフォルト値は以下の様に設定されています。
(5 ((shift) . 1) ((control)))
この設定値で説明する方が分かりやすいかと思いますので、そうします。
リストの最初の値は 5
となっていますが、これは MODIFIERS
が無い(nil
と同等)場合になります。つまり、単にマウスホイールを動かすだけであれば、5 行づつスクロールすることになります。
次の値は MODIFIERS
が shift
(シフトキー)で、移動量が 1
となっていますので、シフトキーを押しながらマウスホイールを動かすと 1 行づつスクロールすることになります。
最後の値は MODIFIERS
が control
(コントロールキー)ですが、移動量が設定されていませんので(nil
と同等)、コントロールキーを押しながらマウスホイールを動かすと near full screen
, つまり一画面分の移動になります。これは scroll-up-command/scroll-down-command
と同じ動作になります。