emacs - 避免在 comint 模式下意外执行

标签 emacs comint-mode

有时在 comint 模式下,点位于缓冲区中的任意位置,我错误地按了 Return。这会将文本发送到底层进程,这可能非常危险。此文本通常包含很多行,并且无论是否偶然,其中一行可能是有效命令。

有什么方法可以告诉 comint 除了最后一次输入之外,不要在 Return 上执行任何操作?

最佳答案

记录的方法似乎是用自定义函数覆盖 comint-get-old-input 变量。最简单的是这样的:

(setq comint-get-old-input (lambda () (end-of-buffer) (comint-get-old-input-default)))

它首先到达缓冲区的末尾,然后才调用 coming-get-olt-input-default,有效地不干扰之前的输出。把它放在你的 init.el 中,简单的测试表明它有效。

关于emacs - 避免在 comint 模式下意外执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51275228/

相关文章:

emacs - 通过 emacs shell 进行 ssh 吗?

emacs - 从 comint-redirect-send-command 取回结果

Emacs shell-模式 : Prevent RET sending input from anywhere

python - Emacs Inferior Python shell 使用每个 python-shell-send-region 命令显示发送消息

emacs - 小缓冲器输入 : word completion with custom dictionary

emacs - 如何将 reftex-default-bibliography 添加到 Latex 作为局部变量?

emacs - 有没有办法将颜色主题从 R GUI 导入 Emacs?

emacs - Dired+ 不再显示详细信息?

emacs - 如何在 Emacs 中向自定义 comint 模式添加自动完成功能?