aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeo Liu2011-03-20 18:35:27 +0800
committerLeo Liu2011-03-20 18:35:27 +0800
commit3ec03f7e4696b4af1af7e1a2fef2a64ccb9224c2 (patch)
tree7db63336e461f8cfbd27a5fcbfcfac5e12688739 /src
parent7d476bdec543cfba684a4d63b8a6bbeb775c75c3 (diff)
downloademacs-3ec03f7e4696b4af1af7e1a2fef2a64ccb9224c2.tar.gz
emacs-3ec03f7e4696b4af1af7e1a2fef2a64ccb9224c2.zip
New variable completing-read-function to customize completing-read
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/minibuf.c34
2 files changed, 39 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5aee468d933..d5d1efebef8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12011-03-20 Leo <sdl.web@gmail.com>
2
3 * minibuf.c (completing-read-function): New variable.
4 (completing-read-default): Rename from completing-read.
5 (completing-read): Call completing-read-function.
6
12011-03-19 Juanma Barranquero <lekktu@gmail.com> 72011-03-19 Juanma Barranquero <lekktu@gmail.com>
2 8
3 * xfaces.c (Fx_load_color_file): 9 * xfaces.c (Fx_load_color_file):
diff --git a/src/minibuf.c b/src/minibuf.c
index 8ff861b2403..3fbe14e9da0 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -72,6 +72,8 @@ Lisp_Object Qcompletion_ignore_case;
72Lisp_Object Qminibuffer_completion_table; 72Lisp_Object Qminibuffer_completion_table;
73Lisp_Object Qminibuffer_completion_predicate; 73Lisp_Object Qminibuffer_completion_predicate;
74Lisp_Object Qminibuffer_completion_confirm; 74Lisp_Object Qminibuffer_completion_confirm;
75Lisp_Object Qcompleting_read_default;
76Lisp_Object Vcompleting_read_function;
75Lisp_Object Quser_variable_p; 77Lisp_Object Quser_variable_p;
76 78
77Lisp_Object Qminibuffer_default; 79Lisp_Object Qminibuffer_default;
@@ -1674,7 +1676,27 @@ If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits
1674 the current input method and the setting of `enable-multibyte-characters'. 1676 the current input method and the setting of `enable-multibyte-characters'.
1675 1677
1676Completion ignores case if the ambient value of 1678Completion ignores case if the ambient value of
1677 `completion-ignore-case' is non-nil. */) 1679 `completion-ignore-case' is non-nil.
1680
1681See also `completing-read-function'. */)
1682 (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method)
1683{
1684 Lisp_Object args[9];
1685 args[0] = Vcompleting_read_function;
1686 args[1] = prompt;
1687 args[2] = collection;
1688 args[3] = predicate;
1689 args[4] = require_match;
1690 args[5] = initial_input;
1691 args[6] = hist;
1692 args[7] = def;
1693 args[8] = inherit_input_method;
1694 return Ffuncall (9, args);
1695}
1696
1697DEFUN ("completing-read-default", Fcompleting_read_default, Scompleting_read_default, 2, 8, 0,
1698 doc: /* Default method for reading from the minibuffer with completion.
1699See `completing-read' for the meaning of the arguments. */)
1678 (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) 1700 (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method)
1679{ 1701{
1680 Lisp_Object val, histvar, histpos, position; 1702 Lisp_Object val, histvar, histpos, position;
@@ -1972,6 +1994,9 @@ syms_of_minibuf (void)
1972 minibuf_save_list = Qnil; 1994 minibuf_save_list = Qnil;
1973 staticpro (&minibuf_save_list); 1995 staticpro (&minibuf_save_list);
1974 1996
1997 Qcompleting_read_default = intern_c_string ("completing-read-default");
1998 staticpro (&Qcompleting_read_default);
1999
1975 Qcompletion_ignore_case = intern_c_string ("completion-ignore-case"); 2000 Qcompletion_ignore_case = intern_c_string ("completion-ignore-case");
1976 staticpro (&Qcompletion_ignore_case); 2001 staticpro (&Qcompletion_ignore_case);
1977 2002
@@ -2116,6 +2141,12 @@ If the value is `confirm-after-completion', the user may exit with an
2116 doc: /* Non-nil means completing file names. */); 2141 doc: /* Non-nil means completing file names. */);
2117 Vminibuffer_completing_file_name = Qnil; 2142 Vminibuffer_completing_file_name = Qnil;
2118 2143
2144 DEFVAR_LISP ("completing-read-function",
2145 &Vcompleting_read_function,
2146 doc: /* The function called by `completing-read' to do the work.
2147It should accept the same arguments as `completing-read'. */);
2148 Vcompleting_read_function = Qcompleting_read_default;
2149
2119 DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form, 2150 DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form,
2120 doc: /* Value that `help-form' takes on inside the minibuffer. */); 2151 doc: /* Value that `help-form' takes on inside the minibuffer. */);
2121 Vminibuffer_help_form = Qnil; 2152 Vminibuffer_help_form = Qnil;
@@ -2191,4 +2222,5 @@ properties. */);
2191 defsubr (&Stest_completion); 2222 defsubr (&Stest_completion);
2192 defsubr (&Sassoc_string); 2223 defsubr (&Sassoc_string);
2193 defsubr (&Scompleting_read); 2224 defsubr (&Scompleting_read);
2225 defsubr (&Scompleting_read_default);
2194} 2226}