summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-03-24 18:05:01 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2011-03-24 18:05:01 -0400
commitd86d2721aa386e943f159895afc4bf2fd53eafd9 (patch)
tree5091d2ff56d2568046c272a2713c654f21b48dcb /lisp/minibuffer.el
parente8974c48ae2f265555c7772ea0989fca5e4158b8 (diff)
First step towards using standard completion in comint.
* lisp/minibuffer.el (completion--flush-all-sorted-completions): Remove itself from hook. (completion-at-point): Let the functions perform the completion immediately and return nil or t. * lisp/comint.el (comint-dynamic-complete-functions): Now identical to completion-at-point-functions. (comint-dynamic-list-input-ring): Remove unused var `index'. (comint--match-partial-filename, comint--unquote&expand-filename): New funs, split from comint-match-partial-filename. (comint-dynamic-complete): Use completion-at-point. (comint-dynamic-complete-filename): Use comint--match-partial-filename.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index e541be9fdd9..f1bc9f2d6d5 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -688,6 +688,8 @@ scroll the window of possible completions."
(t t)))))
(defun completion--flush-all-sorted-completions (&rest ignore)
+ (remove-hook 'after-change-functions
+ 'completion--flush-all-sorted-completions t)
(setq completion-cycling nil)
(setq completion-all-sorted-completions nil))
@@ -1242,6 +1244,8 @@ Point needs to be somewhere between START and END."
(assert (<= start (point)) (<= (point) end))
;; FIXME: undisplay the *Completions* buffer once the completion is done.
(with-wrapper-hook
+ ;; FIXME: Maybe we should use this hook to provide a "display
+ ;; completions" operation as well.
completion-in-region-functions (start end collection predicate)
(let ((minibuffer-completion-table collection)
(minibuffer-completion-predicate predicate)
@@ -1253,7 +1257,9 @@ Point needs to be somewhere between START and END."
(defvar completion-at-point-functions '(tags-completion-at-point-function)
"Special hook to find the completion table for the thing at point.
-It is called without any argument and should return either nil,
+Each function on this hook is called in turns without any argument and should
+return either nil to mean that it is not applicable at point,
+or t to mean that it already performed completion (discouraged),
or a function of no argument to perform completion (discouraged),
or a list of the form (START END COLLECTION &rest PROPS) where
START and END delimit the entity to complete and should include point,
@@ -1271,7 +1277,7 @@ The completion method is determined by `completion-at-point-functions'."
'completion-at-point-functions)))
(cond
((functionp res) (funcall res))
- (res
+ ((consp res)
(let* ((plist (nthcdr 3 res))
(start (nth 0 res))
(end (nth 1 res))
@@ -1279,7 +1285,8 @@ The completion method is determined by `completion-at-point-functions'."
(or (plist-get plist :annotation-function)
completion-annotate-function)))
(completion-in-region start end (nth 2 res)
- (plist-get plist :predicate)))))))
+ (plist-get plist :predicate))))
+ (res)))) ;Maybe completion already happened and the function returned t.
;;; Key bindings.