diff options
| author | Kim F. Storm | 2006-04-06 10:35:22 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-04-06 10:35:22 +0000 |
| commit | b97f1994c406ca48b1fed27a427f2eb3b410f368 (patch) | |
| tree | d7c1a537d77140dc2caf3d81cbea6b3e25c2eb4b | |
| parent | f133ecc0fa1932bccc0129cfd8fc2d047ecf1454 (diff) | |
| download | emacs-b97f1994c406ca48b1fed27a427f2eb3b410f368.tar.gz emacs-b97f1994c406ca48b1fed27a427f2eb3b410f368.zip | |
(ido-mode): Remove ido-ignore-unc-host-regexps from the :set-after list.
(ido-downcase-unc-hosts): New user option. Default on.
(ido-ignore-unc-host-regexps): Don't reset ido-unc-hosts-cache
when it is set, as regexps are now applied on the fly.
(ido-unc-hosts): Keep all known hosts in ido-unc-hosts-cache.
Make C-a DTRT--filter hosts through ido-ignore-unc-host-regexps
on the fly, but only when ido-process-ignore-lists is set.
Do case insensitive filtering if ido-downcase-unc-hosts is set.
Only downcase names if ido-downcase-unc-hosts is set.
| -rw-r--r-- | lisp/ido.el | 76 |
1 files changed, 43 insertions, 33 deletions
diff --git a/lisp/ido.el b/lisp/ido.el index 85a7d6a2ab2..a622a7e6275 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -361,9 +361,9 @@ use either \\[customize] or the function `ido-mode'." | |||
| 361 | :require 'ido | 361 | :require 'ido |
| 362 | :link '(emacs-commentary-link "ido.el") | 362 | :link '(emacs-commentary-link "ido.el") |
| 363 | :set-after '(ido-save-directory-list-file | 363 | :set-after '(ido-save-directory-list-file |
| 364 | ;; These clear ido-unc-hosts-cache, so set them | 364 | ;; This will clear ido-unc-hosts-cache, so set it |
| 365 | ;; before loading history file. | 365 | ;; before loading history file. |
| 366 | ido-unc-hosts ido-ignore-unc-host-regexps) | 366 | ido-unc-hosts) |
| 367 | :type '(choice (const :tag "Turn on only buffer" buffer) | 367 | :type '(choice (const :tag "Turn on only buffer" buffer) |
| 368 | (const :tag "Turn on only file" file) | 368 | (const :tag "Turn on only file" file) |
| 369 | (const :tag "Turn on both buffer and file" both) | 369 | (const :tag "Turn on both buffer and file" both) |
| @@ -649,12 +649,15 @@ hosts on first use of UNC path." | |||
| 649 | (setq ido-unc-hosts-cache t)) | 649 | (setq ido-unc-hosts-cache t)) |
| 650 | :group 'ido) | 650 | :group 'ido) |
| 651 | 651 | ||
| 652 | (defcustom ido-downcase-unc-hosts t | ||
| 653 | "*Non-nil if UNC host names should be downcased." | ||
| 654 | :type 'boolean | ||
| 655 | :group 'ido) | ||
| 656 | |||
| 652 | (defcustom ido-ignore-unc-host-regexps nil | 657 | (defcustom ido-ignore-unc-host-regexps nil |
| 653 | "*List of regexps matching UNC hosts to ignore." | 658 | "*List of regexps matching UNC hosts to ignore. |
| 659 | Case is ignored if `ido-downcase-unc-hosts' is set." | ||
| 654 | :type '(repeat regexp) | 660 | :type '(repeat regexp) |
| 655 | :set #'(lambda (symbol value) | ||
| 656 | (set symbol value) | ||
| 657 | (setq ido-unc-hosts-cache t)) | ||
| 658 | :group 'ido) | 661 | :group 'ido) |
| 659 | 662 | ||
| 660 | (defcustom ido-cache-unc-host-shares-time 8.0 | 663 | (defcustom ido-cache-unc-host-shares-time 8.0 |
| @@ -1135,33 +1138,40 @@ it doesn't interfere with other minibuffer usage.") | |||
| 1135 | 1138 | ||
| 1136 | (defun ido-unc-hosts (&optional query) | 1139 | (defun ido-unc-hosts (&optional query) |
| 1137 | "Return list of UNC host names." | 1140 | "Return list of UNC host names." |
| 1138 | (cond | 1141 | (let ((hosts |
| 1139 | ((listp ido-unc-hosts) | 1142 | (cond |
| 1140 | ido-unc-hosts) ;; static list or nil | 1143 | ((listp ido-unc-hosts) |
| 1141 | ((listp ido-unc-hosts-cache) | 1144 | ido-unc-hosts) ;; static list or nil |
| 1142 | ido-unc-hosts-cache) ;; result of net search | 1145 | ((listp ido-unc-hosts-cache) |
| 1143 | ((and query (fboundp ido-unc-hosts)) | 1146 | ido-unc-hosts-cache) ;; result of net search |
| 1144 | (message "Searching for UNC hosts...") | 1147 | ((and query (fboundp ido-unc-hosts)) |
| 1145 | (let ((hosts (funcall ido-unc-hosts)) host re-list re) | 1148 | (message (propertize "Searching for UNC hosts..." 'face 'highlight)) |
| 1146 | (setq ido-unc-hosts-cache nil) | 1149 | (setq ido-unc-hosts-cache (funcall ido-unc-hosts)) |
| 1147 | (while hosts | 1150 | (message nil) |
| 1148 | (setq host (downcase (car hosts)) | 1151 | ido-unc-hosts-cache) |
| 1149 | hosts (cdr hosts) | 1152 | (query |
| 1150 | re-list ido-ignore-unc-host-regexps) | 1153 | (setq ido-unc-hosts-cache nil)) |
| 1151 | (while re-list | 1154 | (t (fboundp ido-unc-hosts))))) |
| 1152 | (setq re (car re-list) | 1155 | (when query |
| 1153 | re-list (cdr re-list)) | 1156 | (let ((case-fold-search ido-downcase-unc-hosts) |
| 1154 | (if (string-match re host) | 1157 | res host re-list re) |
| 1155 | (setq re-list nil | 1158 | (while hosts |
| 1156 | host nil))) | 1159 | (setq host (car hosts) |
| 1157 | (if host | 1160 | hosts (cdr hosts) |
| 1158 | (setq ido-unc-hosts-cache (cons host ido-unc-hosts-cache))))) | 1161 | re-list (and ido-process-ignore-lists |
| 1159 | (message nil) | 1162 | ido-ignore-unc-host-regexps)) |
| 1160 | (setq ido-unc-hosts-cache | 1163 | (while re-list |
| 1161 | (sort ido-unc-hosts-cache #'string<))) | 1164 | (setq re (car re-list) |
| 1162 | (query | 1165 | re-list (cdr re-list)) |
| 1163 | (setq ido-unc-hosts-cache nil)) | 1166 | (if (string-match re host) |
| 1164 | (t (fboundp ido-unc-hosts)))) | 1167 | (setq re-list nil |
| 1168 | host nil))) | ||
| 1169 | (when host | ||
| 1170 | (when ido-downcase-unc-hosts | ||
| 1171 | (setq host (downcase host))) | ||
| 1172 | (setq res (cons host res)))) | ||
| 1173 | (setq hosts (sort res #'string<)))) | ||
| 1174 | hosts)) | ||
| 1165 | 1175 | ||
| 1166 | (defun ido-unc-hosts-net-view () | 1176 | (defun ido-unc-hosts-net-view () |
| 1167 | "Query network for list of UNC host names using `NET VIEW'." | 1177 | "Query network for list of UNC host names using `NET VIEW'." |