mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-04 14:40:54 -08:00
Support PREDICATE in ido-read-buffer
* lisp/ido.el (ido-predicate): New variable. (ido-read-buffer): Bind it. (ido-make-buffer-list): Use it.
This commit is contained in:
parent
108ce84432
commit
172f7e5488
1 changed files with 12 additions and 1 deletions
13
lisp/ido.el
13
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue