From 7c8d99310322ea51b51cd3ee81e53378022cbe4a Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 21 Dec 1997 01:44:07 +0000 Subject: [PATCH] (Fread_variable): If DEFAULT_VALUE is symbol, use its name. (Fread_command): Likewise. --- src/minibuf.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/minibuf.c b/src/minibuf.c index 2465808211d..7de73d069e2 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -756,9 +756,20 @@ Prompts with PROMPT. By default, return DEFAULT-VALUE.") (prompt, default_value) Lisp_Object prompt, default_value; { - return Fintern (Fcompleting_read (prompt, Vobarray, Qcommandp, Qt, - Qnil, Qnil, default_value, Qnil), - Qnil); + Lisp_Object name, default_string; + + if (NILP (default_value)) + default_string = Qnil; + else if (SYMBOLP (default_value)) + default_string = XSYMBOL (default_value)->name; + else + default_string = default_value; + + name = Fcompleting_read (prompt, Vobarray, Qcommandp, Qt, + Qnil, Qnil, default_string, Qnil); + if (NILP (name)) + return name; + return Fintern (name, Qnil); } #ifdef NOTDEF @@ -780,10 +791,21 @@ A user variable is one whose documentation starts with a `*' character.") (prompt, default_value) Lisp_Object prompt, default_value; { - return Fintern (Fcompleting_read (prompt, Vobarray, - Quser_variable_p, Qt, - Qnil, Qnil, default_value, Qnil), - Qnil); + Lisp_Object name, default_string; + + if (NILP (default_value)) + default_string = Qnil; + else if (SYMBOLP (default_value)) + default_string = XSYMBOL (default_value)->name; + else + default_string = default_value; + + name = Fcompleting_read (prompt, Vobarray, + Quser_variable_p, Qt, + Qnil, Qnil, default_string, Qnil); + if (NILP (name)) + return name; + return Fintern (name, Qnil); } DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0, -- 2.39.2