Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable view-lossage?

Tags:

emacs

I use M-x term as my primary shell in emacs. However, unlike M-x shell, view-lossage will still store my keystroke if my password is prompted. After some search, it looks like there is no way to stop view-lossage recording when prompted.

I would like to know, is it possible to disable it completely ? How can I workaround this problem ?

like image 301
Rangi Lin Avatar asked Dec 23 '13 17:12

Rangi Lin


2 Answers

recent-keys is a C function, so it looks like you'll need to re-compile Emacs.

keyboard.c:

#define NUM_RECENT_KEYS (300)

Just change 300 to 0 and you're done.

like image 61
abo-abo Avatar answered Nov 15 '22 19:11

abo-abo


I figure out a way to workaround the problem, using the clear-this-command-keys function mentioned in @Sean's comment.

Basic idea is to "clear recorded keys when key is send" by advising term-send-raw, I call clear-this-command-keys whenever enter is pressed.

(defadvice term-send-raw (after clear-recorded-key activate)
  (if (string= (kbd "RET") (this-command-keys))
      (clear-this-command-keys)))
like image 41
Rangi Lin Avatar answered Nov 15 '22 18:11

Rangi Lin