From 0208ede7abd03f6945fd3b6c18e7d089096b2d79 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 28 Apr 2013 00:12:17 +0300 Subject: [PATCH] * src/callint.c (Fcall_interactively): Call `Qread_number' for interactive code letter `n' instead of using duplicate code. * lisp/subr.el (read-number): Doc fix about using it by interactive code letter `n'. Fixes: debbugs:14254 --- lisp/ChangeLog | 5 +++++ lisp/subr.el | 4 ++-- src/ChangeLog | 6 ++++++ src/callint.c | 26 +++----------------------- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8a6ea86983d..01cc00cfe07 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-04-27 Juri Linkov + + * subr.el (read-number): Doc fix about using it by interactive + code letter `n'. (Bug#14254) + 2013-04-27 Juri Linkov * desktop.el (desktop-auto-save-timeout): New option. diff --git a/lisp/subr.el b/lisp/subr.el index 523bec59b29..bb23745df72 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2200,11 +2200,11 @@ by doing (clear-string STRING)." ;; And of course, don't keep the sensitive data around. (erase-buffer)))))))) -;; This should be used by `call-interactively' for `n' specs. (defun read-number (prompt &optional default) "Read a numeric value in the minibuffer, prompting with PROMPT. DEFAULT specifies a default value to return if the user just types RET. -The value of DEFAULT is inserted into PROMPT." +The value of DEFAULT is inserted into PROMPT. +This function is used by the `interactive' code letter `n'." (let ((n nil) (default1 (if (consp default) (car default) default))) (when default1 diff --git a/src/ChangeLog b/src/ChangeLog index b7fd539f540..c9d458c3479 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-04-27 Juri Linkov + + * callint.c (Fcall_interactively): Call `Qread_number' for + interactive code letter `n' instead of using duplicate code. + (Bug#14254) + 2013-04-27 Paul Eggert * systime.h (make_timeval): Declare as 'const'. diff --git a/src/callint.c b/src/callint.c index 212dd2e3d62..940ff3ed249 100644 --- a/src/callint.c +++ b/src/callint.c @@ -34,6 +34,7 @@ static Lisp_Object Qcommand_debug_status; static Lisp_Object Qenable_recursive_minibuffers; static Lisp_Object Qhandle_shift_selection; +static Lisp_Object Qread_number; Lisp_Object Qmouse_leave_buffer_hook; @@ -683,29 +684,7 @@ invoke it. If KEYS is omitted or nil, the return value of if (!NILP (prefix_arg)) goto have_prefix_arg; case 'n': /* Read number from minibuffer. */ - { - bool first = 1; - do - { - Lisp_Object str; - if (! first) - { - message1 ("Please enter a number."); - sit_for (make_number (1), 0, 0); - } - first = 0; - - str = Fread_from_minibuffer (callint_message, - Qnil, Qnil, Qnil, Qnil, Qnil, - Qnil); - if (! STRINGP (str) || SCHARS (str) == 0) - args[i] = Qnil; - else - args[i] = Fread (str); - } - while (! NUMBERP (args[i])); - } - visargs[i] = args[i]; + args[i] = call1 (Qread_number, callint_message); break; case 'P': /* Prefix arg in raw form. Does no I/O. */ @@ -903,6 +882,7 @@ syms_of_callint (void) DEFSYM (Qminus, "-"); DEFSYM (Qplus, "+"); DEFSYM (Qhandle_shift_selection, "handle-shift-selection"); + DEFSYM (Qread_number, "read-number"); DEFSYM (Qcall_interactively, "call-interactively"); DEFSYM (Qcommand_debug_status, "command-debug-status"); DEFSYM (Qenable_recursive_minibuffers, "enable-recursive-minibuffers"); -- 2.39.2