summaryrefslogtreecommitdiff
path: root/lisp/ido.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ido.el')
-rw-r--r--lisp/ido.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index da0c9d463d1..7ff3d6820b4 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1135,6 +1135,9 @@ selected.")
(defvar ido-current-directory nil
"Current directory for `ido-find-file'.")
+(defvar ido-predicate nil
+ "Current completion predicate.")
+
(defvar ido-auto-merge-timer nil
"Delay timer for auto merge.")
@@ -3480,6 +3483,11 @@ it is put to the start of the list."
(if ido-temp-list
(nconc ido-temp-list ido-current-buffers)
(setq ido-temp-list ido-current-buffers))
+ (if ido-predicate
+ (setq ido-temp-list (seq-filter
+ (lambda (name)
+ (funcall ido-predicate (cons name (get-buffer name))))
+ ido-temp-list)))
(if default
(setq ido-temp-list
(cons default (delete default ido-temp-list))))
@@ -4845,10 +4853,13 @@ Modified from `icomplete-completions'."
Return the name of a buffer selected.
PROMPT is the prompt to give to the user. DEFAULT if given is the default
buffer to be selected, which will go to the front of the list.
-If REQUIRE-MATCH is non-nil, an existing buffer must be selected."
+If REQUIRE-MATCH is non-nil, an existing buffer must be selected.
+Optional arg PREDICATE if non-nil is a function limiting the
+buffers that can be considered."
(let* ((ido-current-directory nil)
(ido-directory-nonreadable nil)
(ido-directory-too-big nil)
+ (ido-predicate predicate)
(ido-context-switch-command 'ignore)
(buf (ido-read-internal 'buffer prompt 'ido-buffer-history default require-match)))
(if (eq ido-exit 'fallback)