diff --git a/lisp/ido.el b/lisp/ido.el index e52a753..de12c8a 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -2011,11 +2011,12 @@ If INITIAL is non-nil, it specifies the initial input string." (setq ido-exit nil) (setq ido-final-text (catch 'ido - (completing-read - (ido-make-prompt item prompt) - '(("dummy" . 1)) nil nil ; table predicate require-match - (prog1 ido-text-init (setq ido-text-init nil)) ;initial-contents - history)))) + (let ((completing-read-function nil)) + (completing-read + (ido-make-prompt item prompt) + '(("dummy" . 1)) nil nil ; table predicate require-match + (prog1 ido-text-init (setq ido-text-init nil)) ;initial-contents + history))))) (ido-trace "completing-read" ido-final-text) (if (get-buffer ido-completion-buffer) (kill-buffer ido-completion-buffer)) @@ -4835,7 +4836,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..930d50f 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 Vcompleting_read_function; Lisp_Object Quser_variable_p; @@ -1721,6 +1722,9 @@ 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. +If `completing-read-function' is non-nil, call it with all arguments passed +to `completing-read'. + 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. @@ -1779,9 +1783,25 @@ Completion ignores case if the ambient value of Lisp_Object hist, def, inherit_input_method; { Lisp_Object val, histvar, histpos, position; + Lisp_Object args[9]; Lisp_Object init; int pos = 0; int count = SPECPDL_INDEX (); + + if (! NILP (Vcompleting_read_function)) + { + 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); + } + struct gcpro gcpro1; init = initial_input; @@ -2216,6 +2236,12 @@ 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: /* Non-nil means `completing-read' does its work by calling this function. +The function will receive all arguments passed to `completing-read'. */); + Vcompleting_read_function = Qnil; + DEFVAR_LISP ("minibuffer-help-form", &Vminibuffer_help_form, doc: /* Value that `help-form' takes on inside the minibuffer. */); Vminibuffer_help_form = Qnil;