diff --git a/lisp/ido.el b/lisp/ido.el index e52a753..0f464d3 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -2011,7 +2011,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 @@ -4835,7 +4835,7 @@ See `read-directory-name' for additional parameters." (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. diff --git a/src/minibuf.c b/src/minibuf.c index 564346f..6e7e18b 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -132,6 +132,7 @@ Lisp_Object Vminibuffer_completion_table, Qminibuffer_completion_table; Lisp_Object Vminibuffer_completion_predicate, Qminibuffer_completion_predicate; Lisp_Object Vminibuffer_completion_confirm, Qminibuffer_completion_confirm; Lisp_Object Vminibuffer_completing_file_name; +Lisp_Object Qcompleting_read_default, Vcompleting_read_function; Lisp_Object Quser_variable_p; @@ -1721,6 +1722,27 @@ with a space are ignored unless STRING itself starts with a space. */) DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, doc: /* Read a string in the minibuffer, with completion. +This function calls `completing-read-function' to do the work, which +defaults to `completing-read-default' (which see). */) + (prompt, collection, predicate, require_match, initial_input, hist, def, inherit_input_method) + Lisp_Object prompt, collection, predicate, require_match, initial_input; + Lisp_Object hist, def, 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 function for `completing-read-function'. PROMPT is a string to prompt with; normally it ends in a colon and a space. COLLECTION can be a list of strings, an alist, an obarray or a hash table. COLLECTION can also be a function to do the completion itself. @@ -1741,9 +1763,9 @@ REQUIRE-MATCH can take the following values: - anything else behaves like t except that typing RET does not exit if it does non-null completion. -If the input is null, `completing-read' returns DEF, or the first element -of the list of default values, or an empty string if DEF is nil, -regardless of the value of REQUIRE-MATCH. +If the input is null, `completing-read-default' returns DEF, or the +first element of the list of default values, or an empty string if DEF +is nil, regardless of the value of REQUIRE-MATCH. If INITIAL-INPUT is non-nil, insert it in the minibuffer initially, with point positioned at the end. @@ -2077,6 +2099,9 @@ syms_of_minibuf () 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); @@ -2216,6 +2241,11 @@ If the value is `confirm-after-completion', the user may exit with an doc: /* Non-nil means completing file names. */); Vminibuffer_completing_file_name = Qnil; + DEFVAR_LISP ("completing-read-function", + &Vcompleting_read_function, + doc: /* The function to be called by `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; @@ -2291,6 +2321,7 @@ properties. */); defsubr (&Stest_completion); defsubr (&Sassoc_string); defsubr (&Scompleting_read); + defsubr (&Scompleting_read_default); } /* arch-tag: 8f69b601-fba3-484c-a6dd-ceaee54a7a73