diff --git a/lisp/subr.el b/lisp/subr.el index e630087b68f..8dcaef08b65 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3432,12 +3432,18 @@ read-number (let ((n nil) (default1 (if (consp default) (car default) default))) (when default1 - (setq prompt - (if (string-match "\\(\\):[ \t]*\\'" prompt) - (replace-match (format minibuffer-default-prompt-format default1) t t prompt 1) - (replace-regexp-in-string "[ \t]*\\'" - (format minibuffer-default-prompt-format default1) - prompt t t)))) + ;; If PROMPT uses `format-prompt', don't duplicate DEFAULT in + ;; the prompt string. + (if (string-match (regexp-quote + (format minibuffer-default-prompt-format default1)) + prompt) + (setq default1 nil) + (setq prompt + (if (string-match "\\(\\):[ \t]*\\'" prompt) + (replace-match (format minibuffer-default-prompt-format default1) t t prompt 1) + (replace-regexp-in-string "[ \t]*\\'" + (format minibuffer-default-prompt-format default1) + prompt t t))))) (while (progn (let ((str (read-from-minibuffer