changeset 72606:18e29ef6d5d7

(Finternal_complete_buffer): New function. (syms_of_minibuf): Defsubr it. (Fread_buffer): Use it, instead of Vbuffer_alist.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 02 Sep 2006 11:21:55 +0000
parents de654a6735da
children 408b3e9508a1
files src/minibuf.c
diffstat 1 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/minibuf.c	Fri Sep 01 23:52:28 2006 +0000
+++ b/src/minibuf.c	Sat Sep 02 11:21:55 2006 +0000
@@ -1149,6 +1149,24 @@
   return Fintern (name, Qnil);
 }
 
+DEFUN ("internal-complete-buffer", Finternal_complete_buffer, Sinternal_complete_buffer, 3, 3, 0,
+       doc: /* Perform completion on buffer names.
+If the argument FLAG is nil, invoke `try-completion', if it's t, invoke
+`all-completions', otherwise invoke `test-completion'.
+
+The arguments STRING and PREDICATE are as in  `try-completion',
+`all-completions', and `test-completion'. */)
+     (string, predicate, flag)
+     Lisp_Object string, predicate, flag;
+{
+  if (NILP (flag))
+    return Ftry_completion (string, Vbuffer_alist, predicate);
+  else if (EQ (flag, Qt))
+    return Fall_completions (string, Vbuffer_alist, predicate, Qt);
+  else				/* assume `lambda' */
+    return Ftest_completion (string, Vbuffer_alist, predicate);
+}
+
 DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0,
        doc: /* Read the name of a buffer and return as a string.
 Prompt with PROMPT.
@@ -1195,8 +1213,8 @@
 	  prompt = Fformat (3, args);
 	}
 
-      return Fcompleting_read (prompt, Vbuffer_alist, Qnil,
-			       require_match, Qnil, Qbuffer_name_history,
+      return Fcompleting_read (prompt, intern ("internal-complete-buffer"),
+			       Qnil, require_match, Qnil, Qbuffer_name_history,
 			       def, Qnil);
     }
   else
@@ -2915,6 +2933,7 @@
   defsubr (&Sread_string);
   defsubr (&Sread_command);
   defsubr (&Sread_variable);
+  defsubr (&Sinternal_complete_buffer);
   defsubr (&Sread_buffer);
   defsubr (&Sread_no_blanks_input);
   defsubr (&Sminibuffer_depth);