是否可以禁用视图丢失?

Ran*_*Lin 10 emacs

M-x term在emacs中用作主要shell.但是,不同的是M-x shell,view-lossage如果提示我的密码, 仍然会存储我的击键.经过一些搜索后,看起来view-lossage在提示时无法停止录制.

我想知道,是否可以完全禁用它?我该如何解决这个问题?

abo*_*abo 5

recent-keys 是一个C函数,所以看起来你需要重新编译Emacs.

keyboard.c:

#define NUM_RECENT_KEYS (300)
Run Code Online (Sandbox Code Playgroud)

只需将300更改为0就可以了.

  • 显然它并没有阻止它们被记录,但它用`clear-this-command-keys`部分地清除了记录. (3认同)

Ran*_*Lin 4

我找到了解决该问题的方法,使用clear-this-command-keys@Sean 评论中提到的函数。

基本思想是通过建议“发送按键时清除记录的按键” ,每当按下 Enter 时term-send-raw我都会调用。clear-this-command-keys

(defadvice term-send-raw (after clear-recorded-key activate)
  (if (string= (kbd "RET") (this-command-keys))
      (clear-this-command-keys)))
Run Code Online (Sandbox Code Playgroud)