当前位置: 动力学知识库 > 问答 > 编程问答 >

emacs - How can I prevent or avoid interactive function input from being saved to the minibuffer-history?

问题描述:

I have a function that takes in input like so.

(interactive

(list (read-string "Key to use for encryption: ")

(region-beginning)(region-end)))

How can I prevent the inputted string from being saved to minibuffer-history and is there another way to read input that avoids being saved to minibuffer-history?

网友答案:

Have you tried using read-passwd? It was designed for this kind of "secure" input. https://www.gnu.org/software/emacs/manual/html_node/elisp/Reading-a-Password.html

网友答案:

You could temporarily bind minibuffer-history to itself:

(let ((minibuffer-history minibuffer-history)) (read-string "Key to use: "))

After read-string returns, minibuffer-history is restored to its original value, which will not include whatever read-string added to it.

分享给朋友:
您可能感兴趣的文章:
随机阅读: