summaryrefslogtreecommitdiff
path: root/lisp/ido.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ido.el')
-rw-r--r--lisp/ido.el34
1 files changed, 19 insertions, 15 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 761f02ea782..7bf4a92b229 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.")
@@ -1515,9 +1518,7 @@ Removes badly formatted data and ignored directories."
(consp time)
(cond
((integerp (car time))
- (and (/= (car time) 0)
- (integerp (car (cdr time)))
- (/= (car (cdr time)) 0)
+ (and (not (zerop (float-time time)))
(ido-may-cache-directory dir)))
((eq (car time) 'ftp)
(and (numberp (cdr time))
@@ -1579,10 +1580,7 @@ Removes badly formatted data and ignored directories."
(add-hook 'choose-completion-string-functions 'ido-choose-completion-string))
(define-minor-mode ido-everywhere
- "Toggle use of Ido for all buffer/file reading.
-With a prefix argument ARG, enable this feature if ARG is
-positive, and disable it otherwise. If called from Lisp,
-enable the mode if ARG is omitted or nil."
+ "Toggle use of Ido for all buffer/file reading."
:global t
:group 'ido
(remove-function read-file-name-function #'ido-read-file-name)
@@ -1750,7 +1748,8 @@ is enabled then some keybindings are changed in the keymap."
(ido-final-slash dir)
(not (ido-is-unc-host dir))
(file-directory-p dir)
- (> (nth 7 (file-attributes (file-truename dir))) ido-max-directory-size))))
+ (> (file-attribute-size (file-attributes (file-truename dir)))
+ ido-max-directory-size))))
(defun ido-set-current-directory (dir &optional subdir no-merge)
;; Set ido's current directory to DIR or DIR/SUBDIR
@@ -1793,11 +1792,8 @@ is enabled then some keybindings are changed in the keymap."
(defun ido-record-command (command arg)
"Add (COMMAND ARG) to `command-history' if `ido-record-commands' is non-nil."
- (if ido-record-commands ; FIXME: use `when' instead of `if'?
- (let ((cmd (list command arg)))
- (if (or (not command-history) ; FIXME: ditto
- (not (equal cmd (car command-history))))
- (setq command-history (cons cmd command-history))))))
+ (when ido-record-commands
+ (add-to-history 'command-history (list command arg))))
(defun ido-make-prompt (item prompt)
;; Make the prompt for ido-read-internal
@@ -3487,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))))
@@ -3608,7 +3609,7 @@ Uses and updates `ido-dir-file-cache'."
(ftp (ido-is-ftp-directory dir))
(unc (ido-is-unc-host dir))
(attr (if (or ftp unc) nil (file-attributes dir)))
- (mtime (nth 5 attr))
+ (mtime (file-attribute-modification-time attr))
valid)
(when cached ; should we use the cached entry ?
(cond
@@ -4852,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)