问题描述:

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.

相关阅读:
Top