From: Richard M. Stallman Date: Sun, 21 Dec 1997 01:44:07 +0000 (+0000) Subject: (Fread_variable): If DEFAULT_VALUE is symbol, use its name. X-Git-Tag: emacs-20.3~2596 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7c8d99310322ea51b51cd3ee81e53378022cbe4a;p=emacs.git (Fread_variable): If DEFAULT_VALUE is symbol, use its name. (Fread_command): Likewise. --- 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,