]> code.delx.au - gnu-emacs/commitdiff
* subr.el (read-passwd): Allow C-u to erase entry.
authorGlenn Morris <rgm@gnu.org>
Sat, 6 Oct 2012 02:47:26 +0000 (19:47 -0700)
committerGlenn Morris <rgm@gnu.org>
Sat, 6 Oct 2012 02:47:26 +0000 (19:47 -0700)
Fixes: debbugs:12570
lisp/ChangeLog
lisp/subr.el

index 861022aae88c911df717f90444ec6b8004d40e75..0d7932852468906d3715915ee77ec888ffc0ea05 100644 (file)
@@ -1,3 +1,7 @@
+2012-10-06  Glenn Morris  <rgm@gnu.org>
+
+       * subr.el (read-passwd): Allow C-u to erase entry.  (Bug#12570)
+
 2012-10-06  Julian Scheid  <julians37@gmail.com>  (tiny change)
 
        * color.el (color-hsl-to-rgb): Fix incorrect results for
index b0ffb0db746608334d19aa9c87c7d3f2a470bb20..72bedc69c3cf9e380ce4e304d94586fc6c1a2db4 100644 (file)
@@ -2182,8 +2182,16 @@ by doing (clear-string STRING)."
             (set (make-local-variable 'post-self-insert-hook) nil)
             (add-hook 'after-change-functions hide-chars-fun nil 'local))
         (unwind-protect
-            (let ((enable-recursive-minibuffers t))
-              (read-string prompt nil t default)) ; t = "no history"
+            (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))
           (when (buffer-live-p minibuf)
             (with-current-buffer minibuf
               ;; Not sure why but it seems that there might be cases where the