emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103693: New variable completing-read


From: Leo
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103693: New variable completing-read-function to customize completing-read
Date: Sun, 20 Mar 2011 18:35:27 +0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103693
committer: Leo <address@hidden>
branch nick: trunk
timestamp: Sun 2011-03-20 18:35:27 +0800
message:
  New variable completing-read-function to customize completing-read
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/ido.el
  src/ChangeLog
  src/minibuf.c
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2011-03-19 03:58:45 +0000
+++ b/etc/NEWS  2011-03-20 10:35:27 +0000
@@ -81,6 +81,9 @@
 
 ** Completion can cycle, depending on completion-cycle-threshold.
 
+** `completing-read' can be customized using the new variable
+`completing-read-function'
+
 ** auto-mode-case-fold is now enabled by default.
 
 +++

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-20 10:17:10 +0000
+++ b/lisp/ChangeLog    2011-03-20 10:35:27 +0000
@@ -1,3 +1,8 @@
+2011-03-20  Leo  <address@hidden>
+
+       * ido.el (ido-read-internal): Use completing-read-default.
+       (ido-completing-read): Fix compatibility with completing-read.
+
 2011-03-20  Christian Ohler  <address@hidden>
 
        * emacs-lisp/ert.el (ert-run-tests-batch): Remove unused variable.

=== modified file 'lisp/ido.el'
--- a/lisp/ido.el       2011-02-28 20:25:50 +0000
+++ b/lisp/ido.el       2011-03-20 10:35:27 +0000
@@ -1983,7 +1983,7 @@
        (setq ido-exit nil)
        (setq ido-final-text
              (catch 'ido
-               (completing-read
+               (completing-read-default
                 (ido-make-prompt item prompt)
                 '(("dummy" . 1)) nil nil ; table predicate require-match
                 (prog1 ido-text-init (setq ido-text-init nil)) 
;initial-contents
@@ -4740,13 +4740,13 @@
          (concat ido-current-directory filename)))))
 
 ;;;###autoload
-(defun ido-completing-read (prompt choices &optional predicate require-match 
initial-input hist def)
+(defun ido-completing-read (prompt choices &optional predicate require-match 
initial-input hist def inherit-input-method)
   "Ido replacement for the built-in `completing-read'.
 Read a string in the minibuffer with ido-style completion.
 PROMPT is a string to prompt with; normally it ends in a colon and a space.
 CHOICES is a list of strings which are the possible completions.
-PREDICATE is currently ignored; it is included to be compatible
- with `completing-read'.
+PREDICATE and INHERIT-INPUT-METHOD is currently ignored; it is included
+ to be compatible with `completing-read'.
 If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless
  the input is (or completes to) an element of CHOICES or is null.
  If the input is null, `ido-completing-read' returns DEF, or an empty

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-03-19 18:49:31 +0000
+++ b/src/ChangeLog     2011-03-20 10:35:27 +0000
@@ -1,3 +1,9 @@
+2011-03-20  Leo  <address@hidden>
+
+       * minibuf.c (completing-read-function): New variable.
+       (completing-read-default): Rename from completing-read.
+       (completing-read): Call completing-read-function.
+
 2011-03-19  Juanma Barranquero  <address@hidden>
 
        * xfaces.c (Fx_load_color_file):

=== modified file 'src/minibuf.c'
--- a/src/minibuf.c     2011-03-15 01:39:30 +0000
+++ b/src/minibuf.c     2011-03-20 10:35:27 +0000
@@ -72,6 +72,8 @@
 Lisp_Object Qminibuffer_completion_table;
 Lisp_Object Qminibuffer_completion_predicate;
 Lisp_Object Qminibuffer_completion_confirm;
+Lisp_Object Qcompleting_read_default;
+Lisp_Object Vcompleting_read_function;
 Lisp_Object Quser_variable_p;
 
 Lisp_Object Qminibuffer_default;
@@ -1674,7 +1676,27 @@
   the current input method and the setting of `enable-multibyte-characters'.
 
 Completion ignores case if the ambient value of
-  `completion-ignore-case' is non-nil.  */)
+  `completion-ignore-case' is non-nil.
+
+See also `completing-read-function'.  */)
+  (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)
+{
+  Lisp_Object args[9];
+  args[0] = Vcompleting_read_function;
+  args[1] = prompt;
+  args[2] = collection;
+  args[3] = predicate;
+  args[4] = require_match;
+  args[5] = initial_input;
+  args[6] = hist;
+  args[7] = def;
+  args[8] = inherit_input_method;
+  return Ffuncall (9, args);
+}
+
+DEFUN ("completing-read-default", Fcompleting_read_default, 
Scompleting_read_default, 2, 8, 0,
+       doc: /* Default method for reading from the minibuffer with completion.
+See `completing-read' for the meaning of the arguments.  */)
   (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)
 {
   Lisp_Object val, histvar, histpos, position;
@@ -1972,6 +1994,9 @@
   minibuf_save_list = Qnil;
   staticpro (&minibuf_save_list);
 
+  Qcompleting_read_default = intern_c_string ("completing-read-default");
+  staticpro (&Qcompleting_read_default);
+
   Qcompletion_ignore_case = intern_c_string ("completion-ignore-case");
   staticpro (&Qcompletion_ignore_case);
 
@@ -2116,6 +2141,12 @@
               doc: /* Non-nil means completing file names.  */);
   Vminibuffer_completing_file_name = Qnil;
 
+  DEFVAR_LISP ("completing-read-function",
+              &Vcompleting_read_function,
+              doc: /* The function called by `completing-read' to do the work.
+It should accept the same arguments as `completing-read'.  */);
+  Vcompleting_read_function = Qcompleting_read_default;
+
   DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form,
               doc: /* Value that `help-form' takes on inside the minibuffer.  
*/);
   Vminibuffer_help_form = Qnil;
@@ -2191,4 +2222,5 @@
   defsubr (&Stest_completion);
   defsubr (&Sassoc_string);
   defsubr (&Scompleting_read);
+  defsubr (&Scompleting_read_default);
 }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]