summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-12-19 14:54:55 +0000
committerKarl Heuer <kwzh@gnu.org>1997-12-19 14:54:55 +0000
commit176a41ab977e3717a0c33dc557c4cd257dae9428 (patch)
tree5d1b189b3c48a5c4212bc10aa6541b46e56ad7af /src/minibuf.c
parenta00cd619837e1ea9c9eadee03f61bf2f2c4225a3 (diff)
downloademacs-176a41ab977e3717a0c33dc557c4cd257dae9428.tar.gz
(Vread_buffer_function): New var.
(syms_of_minibuf): Set up Lisp var. (Fread_buffer): Use Vread_buffer_function.
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index b8c9f503af3..2465808211d 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -86,6 +86,9 @@ Lisp_Object Qread_file_name_internal;
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;
@@ -792,19 +795,32 @@ If optional third arg REQUIRE-MATCH is non-nil, only existing buffer names are a
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))
+ {
+ 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] = build_string ("%s(default %s) ");
+ 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);
}
DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0,
@@ -1982,6 +1998,10 @@ syms_of_minibuf ()
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;