diff options
author | Philipp Stephani <p.stephani2@gmail.com> | 2019-04-12 14:23:01 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2019-04-19 10:31:02 +0200 |
commit | f5e3c2cc9820a4f7f536a29836cdde6f65230bd3 (patch) | |
tree | 708cffe53e4e7666a365eee964ae49892342f091 /lisp/ido.el | |
parent | 74f54af2b9048cb1ea7a051c9efe079eaaeb4697 (diff) | |
download | emacs-f5e3c2cc9820a4f7f536a29836cdde6f65230bd3.tar.gz |
Add a new user option 'ido-big-directories'.
This provides an alternative to 'ido-max-directory-size', for
directories that are statically known to be too big for Ido
completion.
* lisp/ido.el (ido-big-directories): New user option.
(ido-directory-too-big-p): Use it.
* test/lisp/ido-tests.el (ido-directory-too-big-p): New unit test.
Diffstat (limited to 'lisp/ido.el')
-rw-r--r-- | lisp/ido.el | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lisp/ido.el b/lisp/ido.el index 08540145815..1a3a384ae6b 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -735,6 +735,14 @@ not provide the normal completion. To show the completions, use \\[ido-toggle-i (integer :tag "Size in bytes" 30000)) :group 'ido) +(defcustom ido-big-directories nil + "List of directory pattern strings that should be considered big. +Ido won't attempt to list the contents of directories matching +any of these regular expressions when completing file names." + :type '(repeat regexp) + :group 'ido + :version "27.1") + (defcustom ido-rotate-file-list-default nil "Non-nil means that Ido will always rotate file list to get default in front." :type 'boolean @@ -1743,13 +1751,16 @@ is enabled then some keybindings are changed in the keymap." ;; Return t if dir is a directory, but too big to show ;; Do not check for non-readable directories via tramp, as this causes a premature ;; connect on incomplete tramp paths (after entering just method:). - (let ((ido-enable-tramp-completion nil)) - (and (numberp ido-max-directory-size) - (ido-final-slash dir) - (not (ido-is-unc-host dir)) - (file-directory-p dir) - (> (file-attribute-size (file-attributes (file-truename dir))) - ido-max-directory-size)))) + (let ((ido-enable-tramp-completion nil) + (case-fold-search nil)) + (or (seq-some (lambda (regexp) (string-match-p regexp dir)) + ido-big-directories) + (and (numberp ido-max-directory-size) + (ido-final-slash dir) + (not (ido-is-unc-host dir)) + (file-directory-p dir) + (> (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 |