From 208dee4daaae38f870322142388c43cff848e452 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 2 Jul 2013 20:13:07 -0700 Subject: [PATCH] * lisp/subr.el (y-or-n-p): Handle empty prompts. Fixes: debbugs:14770 --- lisp/ChangeLog | 4 ++++ lisp/subr.el | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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 -- 2.39.2