Lisp_Object Qminibuffer_setup_hook, Vminibuffer_setup_hook;
Lisp_Object Qminibuffer_exit_hook, Vminibuffer_exit_hook;
+/* Function to call to read a buffer name. */
+Lisp_Object Vread_buffer_function;
+
/* Nonzero means completion ignores case. */
int completion_ignore_case;
\f
/* Actual minibuffer invocation. */
-static void read_minibuf_unwind ();
+static Lisp_Object read_minibuf_unwind ();
Lisp_Object get_minibuffer ();
static Lisp_Object read_minibuf ();
/* This function is called on exiting minibuffer, whether normally or not,
and it restores the current window, buffer, etc. */
-static void
+static Lisp_Object
read_minibuf_unwind (data)
Lisp_Object data;
{
windows_or_buffers_changed++;
XSETFASTINT (XWINDOW (window)->last_modified, 0);
XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0);
+
+ return Qnil;
}
\f
(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
(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,
Lisp_Object prompt, def, require_match;
{
Lisp_Object tem;
- Lisp_Object args[3];
-
+ Lisp_Object args[4];
+
if (BUFFERP (def))
def = XBUFFER (def)->name;
- if (!NILP (def))
+
+ if (NILP (Vread_buffer_function))
{
- args[0] = build_string ("%s(default %s) ");
+ if (!NILP (def))
+ {
+ args[0] = build_string ("%s(default %s) ");
+ args[1] = prompt;
+ args[2] = def;
+ prompt = Fformat (3, args);
+ }
+
+ return Fcompleting_read (prompt, Vbuffer_alist, Qnil,
+ require_match, Qnil, Qnil, def, Qnil);
+ }
+ else
+ {
+ args[0] = Vread_buffer_function;
args[1] = prompt;
args[2] = def;
- prompt = Fformat (3, args);
+ args[3] = require_match;
+ return Ffuncall(4, args);
}
- return Fcompleting_read (prompt, Vbuffer_alist, Qnil,
- require_match, Qnil, Qnil, def, Qnil);
}
\f
DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0,
that has no possible completions, and other quick, unobtrusive
messages. */
+void
temp_echo_area_glyphs (m)
char *m;
{
return Qnil;
}
\f
+void
init_minibuf_once ()
{
Vminibuffer_list = Qnil;
staticpro (&Vminibuffer_list);
}
+void
syms_of_minibuf ()
{
minibuf_level = 0;
Qactivate_input_method = intern ("activate-input-method");
staticpro (&Qactivate_input_method);
+ DEFVAR_LISP ("read-buffer-function", &Vread_buffer_function,
+ "If this is non-nil, `read-buffer' does its work by calling this function.");
+ Vread_buffer_function = Qnil;
+
DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook,
"Normal hook run just after entry to minibuffer.");
Vminibuffer_setup_hook = Qnil;
defsubr (&Sminibuffer_message);
}
+void
keys_of_minibuf ()
{
initial_define_key (Vminibuffer_local_map, Ctl ('g'),