diff options
author | Eli Zaretskii <[email protected]> | 2012-10-07 15:37:05 +0200 |
---|---|---|
committer | Eli Zaretskii <[email protected]> | 2012-10-07 15:37:05 +0200 |
commit | 25d99a950debf417295e68a7a7d519b4ddf3e546 (patch) | |
tree | a7d9fba3285833d9bc3e261cda8c197a620d7873 /lisp/subr.el | |
parent | 6f011d8194bd146065c5c2c5d6369a80d6773c68 (diff) | |
parent | 493b5b1c4a7e8b27a0e57c596a83e8b4acad591c (diff) |
Merge from mainline.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 9b557dcfd2..fad624f6a5 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2154,6 +2154,13 @@ any other non-digit terminates the character code and is then used as input.")) (setq first nil)) code)) +(defconst read-passwd-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-map) + (define-key map "\C-u" #'delete-minibuffer-contents) ;bug#12570 + map) + "Keymap used while reading passwords.") + (defun read-passwd (prompt &optional confirm default) "Read a password, prompting with PROMPT, and return it. If optional CONFIRM is non-nil, read the password twice to make sure. @@ -2191,18 +2198,11 @@ by doing (clear-string STRING)." (setq minibuf (current-buffer)) ;; Turn off electricity. (set (make-local-variable 'post-self-insert-hook) nil) + (use-local-map read-passwd-map) (add-hook 'after-change-functions hide-chars-fun nil 'local)) (unwind-protect - (let ((enable-recursive-minibuffers t) - (map minibuffer-local-map) - result) - (define-key map "\C-u" ; bug#12570 - (lambda () (interactive) (delete-minibuffer-contents))) - (setq result - ;; t = no history. - (read-from-minibuffer prompt nil map nil t default)) - (if (and (equal "" result) default) default - result)) + (let ((enable-recursive-minibuffers t)) + (read-string prompt nil t default)) ; t = "no history" (when (buffer-live-p minibuf) (with-current-buffer minibuf ;; Not sure why but it seems that there might be cases where the |