From: Glenn Morris Date: Wed, 3 Jul 2013 03:13:07 +0000 (-0700) Subject: * lisp/subr.el (y-or-n-p): Handle empty prompts. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1943^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=208dee4daaae38f870322142388c43cff848e452;p=emacs.git * lisp/subr.el (y-or-n-p): Handle empty prompts. Fixes: debbugs:14770 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2204d474be9..1cf0d190130 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-07-03 Glenn Morris + + * subr.el (y-or-n-p): Handle empty prompts. (Bug#14770) + 2013-05-26 Fabián Ezequiel Gallina * progmodes/python.el (python-indent-block-enders): Add break, diff --git a/lisp/subr.el b/lisp/subr.el index 88f27c75764..0434e3856f9 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2352,7 +2352,8 @@ is nil and `use-dialog-box' is non-nil." (cond (noninteractive (setq prompt (concat prompt - (if (eq ?\s (aref prompt (1- (length prompt)))) + (if (or (zerop (length prompt)) + (eq ?\s (aref prompt (1- (length prompt))))) "" " ") "(y or n) ")) (let ((temp-prompt prompt)) @@ -2369,7 +2370,8 @@ is nil and `use-dialog-box' is non-nil." (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip))))) (t (setq prompt (concat prompt - (if (eq ?\s (aref prompt (1- (length prompt)))) + (if (or (zerop (length prompt)) + (eq ?\s (aref prompt (1- (length prompt))))) "" " ") "(y or n) ")) (while