aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2011-03-20 18:35:27 +0800
committerLeo Liu2011-03-20 18:35:27 +0800
commit3ec03f7e4696b4af1af7e1a2fef2a64ccb9224c2 (patch)
tree7db63336e461f8cfbd27a5fcbfcfac5e12688739
parent7d476bdec543cfba684a4d63b8a6bbeb775c75c3 (diff)
downloademacs-3ec03f7e4696b4af1af7e1a2fef2a64ccb9224c2.tar.gz
emacs-3ec03f7e4696b4af1af7e1a2fef2a64ccb9224c2.zip
New variable completing-read-function to customize completing-read
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/ido.el8
-rw-r--r--src/ChangeLog6
-rw-r--r--src/minibuf.c34
5 files changed, 51 insertions, 5 deletions
diff --git a/etc/NEWS b/etc/NEWS
index ba33263cf44..a7ec965e3d6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -81,6 +81,9 @@ error, its exit status is 1.
81 81
82** Completion can cycle, depending on completion-cycle-threshold. 82** Completion can cycle, depending on completion-cycle-threshold.
83 83
84** `completing-read' can be customized using the new variable
85`completing-read-function'
86
84** auto-mode-case-fold is now enabled by default. 87** auto-mode-case-fold is now enabled by default.
85 88
86+++ 89+++
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4e71d355886..fe45788d888 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12011-03-20 Leo <sdl.web@gmail.com>
2
3 * ido.el (ido-read-internal): Use completing-read-default.
4 (ido-completing-read): Fix compatibility with completing-read.
5
12011-03-20 Christian Ohler <ohler@gnu.org> 62011-03-20 Christian Ohler <ohler@gnu.org>
2 7
3 * emacs-lisp/ert.el (ert-run-tests-batch): Remove unused variable. 8 * emacs-lisp/ert.el (ert-run-tests-batch): Remove unused variable.
diff --git a/lisp/ido.el b/lisp/ido.el
index 2e67e367a8f..2a5c7cf2f0e 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1983,7 +1983,7 @@ If INITIAL is non-nil, it specifies the initial input string."
1983 (setq ido-exit nil) 1983 (setq ido-exit nil)
1984 (setq ido-final-text 1984 (setq ido-final-text
1985 (catch 'ido 1985 (catch 'ido
1986 (completing-read 1986 (completing-read-default
1987 (ido-make-prompt item prompt) 1987 (ido-make-prompt item prompt)
1988 '(("dummy" . 1)) nil nil ; table predicate require-match 1988 '(("dummy" . 1)) nil nil ; table predicate require-match
1989 (prog1 ido-text-init (setq ido-text-init nil)) ;initial-contents 1989 (prog1 ido-text-init (setq ido-text-init nil)) ;initial-contents
@@ -4740,13 +4740,13 @@ See `read-directory-name' for additional parameters."
4740 (concat ido-current-directory filename))))) 4740 (concat ido-current-directory filename)))))
4741 4741
4742;;;###autoload 4742;;;###autoload
4743(defun ido-completing-read (prompt choices &optional predicate require-match initial-input hist def) 4743(defun ido-completing-read (prompt choices &optional predicate require-match initial-input hist def inherit-input-method)
4744 "Ido replacement for the built-in `completing-read'. 4744 "Ido replacement for the built-in `completing-read'.
4745Read a string in the minibuffer with ido-style completion. 4745Read a string in the minibuffer with ido-style completion.
4746PROMPT is a string to prompt with; normally it ends in a colon and a space. 4746PROMPT is a string to prompt with; normally it ends in a colon and a space.
4747CHOICES is a list of strings which are the possible completions. 4747CHOICES is a list of strings which are the possible completions.
4748PREDICATE is currently ignored; it is included to be compatible 4748PREDICATE and INHERIT-INPUT-METHOD is currently ignored; it is included
4749 with `completing-read'. 4749 to be compatible with `completing-read'.
4750If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless 4750If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless
4751 the input is (or completes to) an element of CHOICES or is null. 4751 the input is (or completes to) an element of CHOICES or is null.
4752 If the input is null, `ido-completing-read' returns DEF, or an empty 4752 If the input is null, `ido-completing-read' returns DEF, or an empty
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}