From d5acb99a199d83cde1a43482709c3e9d4ec34b2f Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 5 Oct 2012 19:47:26 -0700 Subject: [PATCH] * subr.el (read-passwd): Allow C-u to erase entry. Fixes: debbugs:12570 --- lisp/ChangeLog | 4 ++++ lisp/subr.el | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 861022aae8..0d79328524 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-10-06 Glenn Morris + + * subr.el (read-passwd): Allow C-u to erase entry. (Bug#12570) + 2012-10-06 Julian Scheid (tiny change) * color.el (color-hsl-to-rgb): Fix incorrect results for diff --git a/lisp/subr.el b/lisp/subr.el index b0ffb0db74..72bedc69c3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -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 -- 2.20.1