在Emacs中禁用鼠标滚动

4

我在互联网上找到的所有信息都告诉我,emacs默认情况下禁用鼠标滚动,但是当我的手指靠近笔记本电脑上的触摸板时,它非常热情地滚动。我没有给它许可这样做,而这是我的.emacs文件来证明:

;; Line by line scrolling                                                                                                                                      
(setq scroll-step 1)

;; Turn off backup file creation                                                                                                                               
;;(setq make-backup-files nil)                                                                                                                                 

;; Enable backup files                                                                                                                                         
(setq make-backup-files t)

;; Save all backup files to this directory                                                                                                                     
(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))

;; Show column number                                                                                                                                          
(column-number-mode 1)

;; Fix C indenting                                                                                                                                             
(setq c-default-style "bsd"
      c-basic-offset 8)

有时候我的拇指会刷过触摸板,突然间我就会在另一行的中间或上面或下面进行输入。如何防止这种情况发生?

编辑 运行M-x customize-option mouse-wheel-mode得到:

鼠标滚轮模式:[隐藏值] [切换] 关闭(nil)

[状态]:在自定义之外更改;在此处操作可能不可靠。

如果启用鼠标滚轮模式,则为非nil。[隐藏其他]
有关此次要模式的说明,请参见命令mouse-wheel-mode'。
直接设置此变量无效;
请自定义它(请参见信息节点
Easy Customization'),
或调用函数`mouse-wheel-mode'。 组:[鼠标]


1
你使用什么操作系统?你在终端中使用Emacs吗? - nschum
Linux Mint,我将“emacs”别名为“emacs -nw”。 - Colin Woodbury
那你确定是Emacs在滚动而不是你的终端? - nschum
4个回答

8

默认情况下它是启用的(至少自从Emacs 23版本以来)。

要在本地关闭它:

(mouse-wheel-mode -1)

关闭它(全局)的方法如下:
M-x customize-option mouse-wheel-mode ; set to nil and save

但也许您只是想调整设置:请查看 M-x customize-group mouse RET


令人惊讶的是,(mouse-wheel-mode -1) 没有解决问题。 ...而且我不确定你的第二个建议是什么意思。:( - Colin Woodbury
这将在本地禁用mouse-wheel-mode。要全局禁用它,您必须在鼠标组中自定义mouse-wheel-mode。我会把它添加到答案中。 - Michael Markert
"mouse-wheel-mode"是一个全局模式,所以第一个就足够了。 - nschum
大家好,看一下编辑。似乎在emacs中,滚动被禁用了。但实际上并没有。 - Colin Woodbury
它禁用了鼠标滚轮,但每当触摸鼠标滚轮时,它也会不断发出错误提示音。 - Drew

4
我已经完成以下操作:
;; Disable mouse wheel (and two finger swipe) scrolling because
;; it scrolls horribly and I would rather work without it.

(mouse-wheel-mode -1)

(global-set-key [wheel-up] 'ignore)
(global-set-key [wheel-down] 'ignore)
(global-set-key [double-wheel-up] 'ignore)
(global-set-key [double-wheel-down] 'ignore)
(global-set-key [triple-wheel-up] 'ignore)
(global-set-key [triple-wheel-down] 'ignore)

最后一部分禁用了滚轮事件,消除了令人烦恼的嘟嘟声。

2

以下是我用来禁用所有鼠标滚动(包括水平滚动)的方法:

(mouse-wheel-mode -1)
(global-set-key [wheel-up] 'ignore)
(global-set-key [double-wheel-up] 'ignore)
(global-set-key [triple-wheel-up] 'ignore)
(global-set-key [wheel-down] 'ignore)
(global-set-key [double-wheel-down] 'ignore)
(global-set-key [triple-wheel-down] 'ignore)
(global-set-key [wheel-left] 'ignore)
(global-set-key [double-wheel-left] 'ignore)
(global-set-key [triple-wheel-left] 'ignore)
(global-set-key [wheel-right] 'ignore)
(global-set-key [double-wheel-right] 'ignore)
(global-set-key [triple-wheel-right] 'ignore)

0

我认为你看到的不是鼠标滚轮滚动,而更像是在触摸板上误触点击。如果你的鼠标指针指向的位置与你正在输入的位置不同,而你意外地刷了一下触摸板,你的触摸板/操作系统会将其解释为鼠标点击,那么你的输入点就会跳到鼠标指针所指的位置。

你可以通过禁用触摸板的轻触点击功能或使用某些触摸板/操作系统提供的功能,在你输入时完全禁用触摸板来解决这个问题。如何执行这些操作取决于你的触摸板/驱动程序/操作系统组合。


不,我在MacBook Pro上运行Linux Mint,触摸板需要用力点击才能注册鼠标按钮按下。 - Colin Woodbury

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接