我正在使用Linux,并在emacs和sublime text之间交替使用。在崇高的文本中,Ctrl-Z 是撤消的。这意味着有时我有时会在 emacs 中按 Ctrl-Z;不幸的是,当我这样做时,整个过程只是冻结。我认为这与挂起进程的典型 Ctrl-Z 行为有关;但是我在 GUI 中运行 Emacs,所以为什么它会有这种行为有点超出我。有什么办法可以改变这一点吗?
我建议以下内容,而不是简单地完全禁用绑定:
(global-unset-key (kbd "C-z"))
(global-set-key (kbd "C-z C-z") 'my-suspend-frame)
(defun my-suspend-frame ()
"In a GUI environment, do nothing; otherwise `suspend-frame'."
(interactive)
(if (display-graphic-p)
(message "suspend-frame disabled for graphical displays.")
(suspend-frame)))
或者你可以直接将函数绑定到C-z
,但我发现打开它作为其他命令的前缀绑定非常有用——考虑到我实际上很少需要调用suspend-frame
,我发现双C-z C-z
同样方便。