aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-10-06 13:29:15 -0400
committerStefan Monnier2012-10-06 13:29:15 -0400
commitd39109c3e111bf2403f6e636ff1273f2701683e7 (patch)
treeb8229720cb8a079c6276fbbc4e0fb34ac385e444
parent5694896dfc322e90c0e7e064002cf25296394d75 (diff)
downloademacs-d39109c3e111bf2403f6e636ff1273f2701683e7.tar.gz
emacs-d39109c3e111bf2403f6e636ff1273f2701683e7.zip
* lisp/subr.el (read-passwd-map): New var.
(read-passwd): Use `read-string' again. * lisp/minibuffer.el (delete-minibuffer-contents): Make it interactive.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/minibuffer.el1
-rw-r--r--lisp/subr.el21
3 files changed, 17 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6235f9f28ca..292a536f2c9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-10-06 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * subr.el (read-passwd-map): New var.
4 (read-passwd): Use `read-string' again.
5 * minibuffer.el (delete-minibuffer-contents): Make it interactive.
6
12012-10-06 Jambunathan K <kjambunathan@gmail.com> 72012-10-06 Jambunathan K <kjambunathan@gmail.com>
2 8
3 * register.el (append-to-register, prepend-to-register): 9 * register.el (append-to-register, prepend-to-register):
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index cf990019abc..a9be1749423 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -632,6 +632,7 @@ That is what completion commands operate on."
632(defun delete-minibuffer-contents () 632(defun delete-minibuffer-contents ()
633 "Delete all user input in a minibuffer. 633 "Delete all user input in a minibuffer.
634If the current buffer is not a minibuffer, erase its entire contents." 634If the current buffer is not a minibuffer, erase its entire contents."
635 (interactive)
635 ;; We used to do `delete-field' here, but when file name shadowing 636 ;; We used to do `delete-field' here, but when file name shadowing
636 ;; is on, the field doesn't cover the entire minibuffer contents. 637 ;; is on, the field doesn't cover the entire minibuffer contents.
637 (delete-region (minibuffer-prompt-end) (point-max))) 638 (delete-region (minibuffer-prompt-end) (point-max)))
diff --git a/lisp/subr.el b/lisp/subr.el
index e8eef541f27..e438a860cbc 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2143,6 +2143,13 @@ any other non-digit terminates the character code and is then used as input."))
2143 (setq first nil)) 2143 (setq first nil))
2144 code)) 2144 code))
2145 2145
2146(defconst read-passwd-map
2147 (let ((map (make-sparse-keymap)))
2148 (set-keymap-parent map minibuffer-local-map)
2149 (define-key map "\C-u" #'delete-minibuffer-contents) ;bug#12570
2150 map)
2151 "Keymap used while reading passwords.")
2152
2146(defun read-passwd (prompt &optional confirm default) 2153(defun read-passwd (prompt &optional confirm default)
2147 "Read a password, prompting with PROMPT, and return it. 2154 "Read a password, prompting with PROMPT, and return it.
2148If optional CONFIRM is non-nil, read the password twice to make sure. 2155If optional CONFIRM is non-nil, read the password twice to make sure.
@@ -2180,19 +2187,11 @@ by doing (clear-string STRING)."
2180 (setq minibuf (current-buffer)) 2187 (setq minibuf (current-buffer))
2181 ;; Turn off electricity. 2188 ;; Turn off electricity.
2182 (set (make-local-variable 'post-self-insert-hook) nil) 2189 (set (make-local-variable 'post-self-insert-hook) nil)
2190 (use-local-map read-passwd-map)
2183 (add-hook 'after-change-functions hide-chars-fun nil 'local)) 2191 (add-hook 'after-change-functions hide-chars-fun nil 'local))
2184 (unwind-protect 2192 (unwind-protect
2185 (let ((enable-recursive-minibuffers t) 2193 (let ((enable-recursive-minibuffers t))
2186 (map (make-sparse-keymap)) 2194 (read-string prompt nil t default)) ; t = "no history"
2187 result)
2188 (set-keymap-parent map minibuffer-local-map)
2189 (define-key map "\C-u" ; bug#12570
2190 (lambda () (interactive) (delete-minibuffer-contents)))
2191 (setq result
2192 ;; t = no history.
2193 (read-from-minibuffer prompt nil map nil t default))
2194 (if (and (equal "" result) default) default
2195 result))
2196 (when (buffer-live-p minibuf) 2195 (when (buffer-live-p minibuf)
2197 (with-current-buffer minibuf 2196 (with-current-buffer minibuf
2198 ;; Not sure why but it seems that there might be cases where the 2197 ;; Not sure why but it seems that there might be cases where the