552 |
:type '(repeat regexp) |
:type '(repeat regexp) |
553 |
:group 'ido) |
:group 'ido) |
554 |
|
|
555 |
|
|
556 |
|
(defcustom ido-enable-tramp-completion t |
557 |
|
"*Non-nil means that ido shall perform tramp method and server name completion. |
558 |
|
A tramp file name uses the following syntax: /method:user@host:path." |
559 |
|
:type 'boolean |
560 |
|
:group 'ido) |
561 |
|
|
562 |
(defcustom ido-record-ftp-work-directories t |
(defcustom ido-record-ftp-work-directories t |
563 |
"*Non-nil means that ftp paths are recorded in work directory list." |
"*Non-nil means that ftp paths are recorded in work directory list." |
564 |
:type 'boolean |
:type 'boolean |
643 |
:type 'boolean |
:type 'boolean |
644 |
:group 'ido) |
:group 'ido) |
645 |
|
|
646 |
(defcustom ido-enter-single-matching-directory nil |
(defcustom ido-enter-single-matching-directory 'slash |
647 |
"*Automatically enter sub-directory if it is the only matching item, if non-nil. |
"*Automatically enter sub-directory if it is the only matching item, if non-nil. |
648 |
If value is 'slash, only enter if typing final slash, else do it always." |
If value is 'slash, only enter if typing final slash, else do it always." |
649 |
:type '(choice (const :tag "Never" nil) |
:type '(choice (const :tag "Never" nil) |
980 |
(defun ido-toggle-trace (arg) |
(defun ido-toggle-trace (arg) |
981 |
(interactive "P") |
(interactive "P") |
982 |
(setq ido-trace-enable (or arg (not ido-trace-enable))) |
(setq ido-trace-enable (or arg (not ido-trace-enable))) |
983 |
|
(if ido-trace-enable |
984 |
|
(message "IDO trace on")) |
985 |
(let ((b (get-buffer " *IDO Trace*"))) |
(let ((b (get-buffer " *IDO Trace*"))) |
986 |
(if b |
(if b |
987 |
(if ido-trace-enable |
(if ido-trace-enable |
988 |
(kill-buffer b) |
(kill-buffer b) |
989 |
(pop-to-buffer b t t))))) |
(pop-to-buffer b t t) |
990 |
|
(setq truncate-lines t))))) |
991 |
|
|
992 |
|
(defun ido-is-tramp-root (&optional dir) |
993 |
|
(setq dir (or dir ido-current-directory)) |
994 |
|
(and ido-enable-tramp-completion |
995 |
|
(string-match "\\`/[^/][^/]+:\\([^/:@]+@\\)?\\'" dir))) |
996 |
|
|
997 |
(defun ido-is-root-directory (&optional dir) |
(defun ido-is-root-directory (&optional dir) |
998 |
(setq dir (or dir ido-current-directory)) |
(setq dir (or dir ido-current-directory)) |
999 |
(if (memq system-type '(windows-nt ms-dos)) |
(or |
1000 |
(string-match "\\`[a-zA-Z]:[/\\]\\'" dir) |
(string-equal "/" dir) |
1001 |
(string-equal "/" dir))) |
(and (memq system-type '(windows-nt ms-dos)) |
1002 |
|
(string-match "\\`[a-zA-Z]:[/\\]\\'" dir)) |
1003 |
|
(if ido-enable-tramp-completion |
1004 |
|
(ido-is-tramp-root dir) |
1005 |
|
(string-match "\\`/[^:/][^:/]+:\\'" dir)))) |
1006 |
|
|
1007 |
(defun ido-is-ftp-directory (&optional dir) |
(defun ido-is-ftp-directory (&optional dir) |
1008 |
(string-match "\\`/[^/:][^/:]+:/" (or dir ido-current-directory))) |
(string-match |
1009 |
|
(if ido-enable-tramp-completion |
1010 |
|
"\\`/[^/:][^/:]+:" ;; like tramp-file-name-regexp-unified, but doesn't match single drive letters |
1011 |
|
"\\`/[^/:][^/:]+:/") |
1012 |
|
(or dir ido-current-directory))) |
1013 |
|
|
1014 |
(defun ido-is-slow-ftp-host (&optional dir) |
(defun ido-is-slow-ftp-host (&optional dir) |
1015 |
(and (or ido-slow-ftp-hosts ido-slow-ftp-host-regexps) |
(and (or ido-slow-ftp-hosts ido-slow-ftp-host-regexps) |
1016 |
(setq dir (or dir ido-current-directory)) |
(setq dir (or dir ido-current-directory)) |
1017 |
;; (featurep 'ange-ftp) |
;; (featurep 'ange-ftp) |
1018 |
;; (ange-ftp-ftp-name dir) |
;; (ange-ftp-ftp-name dir) |
1019 |
(string-match "\\`/\\([^/:]*@\\)?\\([^@/:][^@/:]+\\):/" dir) |
(string-match |
1020 |
|
(if ido-enable-tramp-completion |
1021 |
|
"\\`/\\([^/]+[@:]\\)*\\([^@/:][^@/:]+\\):" |
1022 |
|
"\\`/\\([^/:]*@\\)?\\([^@/:][^@/:]+\\):/") |
1023 |
|
dir) |
1024 |
(let ((host (substring dir (match-beginning 2) (match-end 2)))) |
(let ((host (substring dir (match-beginning 2) (match-end 2)))) |
1025 |
(or (member host ido-slow-ftp-hosts) |
(or (member host ido-slow-ftp-hosts) |
1026 |
(let ((re ido-slow-ftp-host-regexps)) |
(let ((re ido-slow-ftp-host-regexps)) |
1041 |
|
|
1042 |
(defun ido-may-cache-directory (&optional dir) |
(defun ido-may-cache-directory (&optional dir) |
1043 |
(setq dir (or dir ido-current-directory)) |
(setq dir (or dir ido-current-directory)) |
1044 |
(if (and (memq system-type '(windows-nt ms-dos)) |
(cond |
1045 |
(string-match "\\`[a-zA-Z]:[/\\]\\'" dir)) |
((and (ido-is-root-directory dir) |
1046 |
nil |
(or ido-enable-tramp-completion |
1047 |
(or (not (ido-is-ftp-directory dir)) |
(memq system-type '(windows-nt ms-dos)))) |
1048 |
(ido-cache-ftp-valid)))) |
nil) |
1049 |
|
((not (ido-is-ftp-directory dir)) |
1050 |
|
t) |
1051 |
|
((ido-cache-ftp-valid) |
1052 |
|
t))) |
1053 |
|
|
1054 |
(defun ido-pp (list &optional sep) |
(defun ido-pp (list &optional sep) |
1055 |
(let ((print-level nil) (eval-expression-print-level nil) |
(let ((print-level nil) (eval-expression-print-level nil) |
1359 |
(setq dir (ido-name dir)) |
(setq dir (ido-name dir)) |
1360 |
(cond |
(cond |
1361 |
((string-match "/\\'" dir) dir) |
((string-match "/\\'" dir) dir) |
1362 |
|
((ido-is-tramp-root dir) dir) |
1363 |
(fix-it (concat dir "/")) |
(fix-it (concat dir "/")) |
1364 |
(t nil))) |
(t nil))) |
1365 |
|
|
1491 |
(ido-define-mode-map) |
(ido-define-mode-map) |
1492 |
(setq ido-text-init initial) |
(setq ido-text-init initial) |
1493 |
(while (not done) |
(while (not done) |
1494 |
(ido-trace "\n_LOOP_") |
(ido-trace "\n_LOOP_" ido-text-init) |
1495 |
(setq ido-exit nil) |
(setq ido-exit nil) |
1496 |
(setq ido-rescan t) |
(setq ido-rescan t) |
1497 |
(setq ido-rotate nil) |
(setq ido-rotate nil) |
1644 |
(setq ido-text-init f |
(setq ido-text-init f |
1645 |
path nil)))))) |
path nil)))))) |
1646 |
(t |
(t |
|
(setq ido-text-init nil) |
|
1647 |
(setq ido-text-init (read-string (concat prompt "[EDIT] ") ido-final-text)))) |
(setq ido-text-init (read-string (concat prompt "[EDIT] ") ido-final-text)))) |
1648 |
nil) |
nil) |
1649 |
|
|
1656 |
((eq ido-exit 'updir) |
((eq ido-exit 'updir) |
1657 |
;; cannot go up if already at the root-dir (Unix) or at the |
;; cannot go up if already at the root-dir (Unix) or at the |
1658 |
;; root-dir of a certain drive (Windows or MS-DOS). |
;; root-dir of a certain drive (Windows or MS-DOS). |
1659 |
(or (ido-is-root-directory) |
(if (ido-is-tramp-root) |
1660 |
(ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))) |
(when (string-match "\\`\\(/\\([^/]+[:@]\\)*\\)\\([^/]+\\)[:@]\\'" ido-current-directory) |
1661 |
(setq ido-set-default-item t)) |
(setq ido-text-init (match-string 3 ido-current-directory)) |
1662 |
|
(ido-set-current-directory (match-string 1 ido-current-directory)) |
1663 |
|
(setq ido-set-default-item t)) |
1664 |
|
(unless (ido-is-root-directory) |
1665 |
|
(ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1))) |
1666 |
|
(setq ido-set-default-item t)))) |
1667 |
|
|
1668 |
;; Handling the require-match must be done in a better way. |
;; Handling the require-match must be done in a better way. |
1669 |
((and require-match (not (ido-existing-item-p))) |
((and require-match (not (ido-existing-item-p))) |
1690 |
(or (ido-is-root-directory) |
(or (ido-is-root-directory) |
1691 |
(ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))) |
(ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))) |
1692 |
(setq ido-set-default-item t)) |
(setq ido-set-default-item t)) |
1693 |
((and (string-equal ido-current-directory "/") |
|
1694 |
(string-match "..:\\'" ido-selected)) ;; Ange-ftp |
((and (string-match (if ido-enable-tramp-completion "..[:@]\\'" "..:\\'") ido-selected) |
1695 |
(ido-set-current-directory "/" ido-selected) |
(ido-is-root-directory)) ;; Ange-ftp or Tramp |
1696 |
|
(ido-set-current-directory ido-current-directory ido-selected) |
1697 |
|
(ido-trace "tramp prefix" ido-selected) |
1698 |
(if (ido-is-slow-ftp-host) |
(if (ido-is-slow-ftp-host) |
1699 |
(setq ido-exit 'fallback |
(setq ido-exit 'fallback |
1700 |
done t) |
done t) |
1701 |
(setq ido-set-default-item t))) |
(setq ido-set-default-item t))) |
|
|
|
1702 |
((or (string-match "[/\\][^/\\]" ido-selected) |
((or (string-match "[/\\][^/\\]" ido-selected) |
1703 |
(and (memq system-type '(windows-nt ms-dos)) |
(and (memq system-type '(windows-nt ms-dos)) |
1704 |
(string-match "\\`.:" ido-selected))) |
(string-match "\\`.:" ido-selected))) |
1973 |
(when ido-completion-buffer |
(when ido-completion-buffer |
1974 |
(call-interactively (setq this-command ido-cannot-complete-command)))) |
(call-interactively (setq this-command ido-cannot-complete-command)))) |
1975 |
|
|
1976 |
((= 1 (length ido-matches)) |
((and (= 1 (length ido-matches)) |
1977 |
|
(not (and ido-enable-tramp-completion |
1978 |
|
(string-equal ido-current-directory "/") |
1979 |
|
(string-match "..[@:]\\'" (car ido-matches))))) |
1980 |
;; only one choice, so select it. |
;; only one choice, so select it. |
1981 |
(exit-minibuffer)) |
(exit-minibuffer)) |
1982 |
|
|
2622 |
(nconc ido-temp-list items) |
(nconc ido-temp-list items) |
2623 |
(setq ido-temp-list items))) |
(setq ido-temp-list items))) |
2624 |
|
|
2625 |
|
(defun ido-file-name-all-completions1 (dir) |
2626 |
|
(if (and ido-enable-tramp-completion |
2627 |
|
(string-match "\\`/\\([^/:]+:\\([^/:@]+@\\)?\\)\\'" dir)) |
2628 |
|
|
2629 |
|
;; Trick tramp's file-name-all-completions handler to DTRT, as it |
2630 |
|
;; has some pretty obscure requirements. This seems to work... |
2631 |
|
;; /ftp: => (f-n-a-c "/ftp:" "") |
2632 |
|
;; /ftp:kfs: => (f-n-a-c "" "/ftp:kfs:") |
2633 |
|
;; /ftp:kfs@ => (f-n-a-c "ftp:kfs@" "/") |
2634 |
|
;; /ftp:kfs@kfs: => (f-n-a-c "" "/ftp:kfs@kfs:") |
2635 |
|
;; Currently no attempt is made to handle multi: stuff. |
2636 |
|
|
2637 |
|
(let* ((prefix (match-string 1 dir)) |
2638 |
|
(user-flag (match-beginning 2)) |
2639 |
|
(len (and prefix (length prefix))) |
2640 |
|
compl) |
2641 |
|
(if user-flag |
2642 |
|
(setq dir (substring dir 1))) |
2643 |
|
(require 'tramp nil t) |
2644 |
|
(ido-trace "tramp complete" dir) |
2645 |
|
(setq compl (file-name-all-completions dir (if user-flag "/" ""))) |
2646 |
|
(if (> len 0) |
2647 |
|
(mapcar (lambda (c) (substring c len)) compl) |
2648 |
|
compl)) |
2649 |
|
(file-name-all-completions "" dir))) |
2650 |
|
|
2651 |
(defun ido-file-name-all-completions (dir) |
(defun ido-file-name-all-completions (dir) |
2652 |
;; Return name of all files in DIR |
;; Return name of all files in DIR |
2653 |
;; Uses and updates ido-dir-file-cache |
;; Uses and updates ido-dir-file-cache |
2674 |
(if (and ftp (file-readable-p dir)) |
(if (and ftp (file-readable-p dir)) |
2675 |
(setq mtime (cons 'ftp (ido-time-stamp)))) |
(setq mtime (cons 'ftp (ido-time-stamp)))) |
2676 |
(if mtime |
(if mtime |
2677 |
(setq cached (cons dir (cons mtime (file-name-all-completions "" dir))) |
(setq cached (cons dir (cons mtime (ido-file-name-all-completions1 dir))) |
2678 |
ido-dir-file-cache (cons cached ido-dir-file-cache))) |
ido-dir-file-cache (cons cached ido-dir-file-cache))) |
2679 |
(if (> (length ido-dir-file-cache) ido-max-dir-file-cache) |
(if (> (length ido-dir-file-cache) ido-max-dir-file-cache) |
2680 |
(setcdr (nthcdr (1- ido-max-dir-file-cache) ido-dir-file-cache) nil))) |
(setcdr (nthcdr (1- ido-max-dir-file-cache) ido-dir-file-cache) nil))) |
2681 |
(and cached |
(and cached |
2682 |
(cdr (cdr cached)))) |
(cdr (cdr cached)))) |
2683 |
(file-name-all-completions "" dir))) |
(ido-file-name-all-completions1 dir))) |
2684 |
|
|
2685 |
(defun ido-remove-cached-dir (dir) |
(defun ido-remove-cached-dir (dir) |
2686 |
;; Remove dir from ido-dir-file-cache |
;; Remove dir from ido-dir-file-cache |
2694 |
(defun ido-make-file-list1 (dir &optional merged) |
(defun ido-make-file-list1 (dir &optional merged) |
2695 |
;; Return list of non-ignored files in DIR |
;; Return list of non-ignored files in DIR |
2696 |
;; If MERGED is non-nil, each file is cons'ed with DIR |
;; If MERGED is non-nil, each file is cons'ed with DIR |
2697 |
(and (file-directory-p dir) |
(and (or (ido-is-tramp-root dir) (file-directory-p dir)) |
2698 |
(delq nil |
(delq nil |
2699 |
(mapcar |
(mapcar |
2700 |
(lambda (name) |
(lambda (name) |
2742 |
(defun ido-make-dir-list1 (dir &optional merged) |
(defun ido-make-dir-list1 (dir &optional merged) |
2743 |
;; Return list of non-ignored subdirs in DIR |
;; Return list of non-ignored subdirs in DIR |
2744 |
;; If MERGED is non-nil, each subdir is cons'ed with DIR |
;; If MERGED is non-nil, each subdir is cons'ed with DIR |
2745 |
(and (file-directory-p dir) |
(and (or (ido-is-tramp-root dir) (file-directory-p dir)) |
2746 |
(delq nil |
(delq nil |
2747 |
(mapcar |
(mapcar |
2748 |
(lambda (name) |
(lambda (name) |
2816 |
(defun ido-set-matches1 (items &optional do-full) |
(defun ido-set-matches1 (items &optional do-full) |
2817 |
;; Return list of matches in items |
;; Return list of matches in items |
2818 |
(let* ((case-fold-search ido-case-fold) |
(let* ((case-fold-search ido-case-fold) |
2819 |
(rexq (if ido-enable-regexp ido-text (regexp-quote ido-text))) |
(slash (and (not ido-enable-prefix) (ido-final-slash ido-text))) |
2820 |
|
(text (if slash (substring ido-text 0 -1) ido-text)) |
2821 |
|
(rexq (concat (if ido-enable-regexp text (regexp-quote text)) (if slash ".*/" ""))) |
2822 |
(re (if ido-enable-prefix (concat "\\`" rexq) rexq)) |
(re (if ido-enable-prefix (concat "\\`" rexq) rexq)) |
2823 |
(full-re (and do-full (not ido-enable-regexp) (not (string-match "\$\\'" re)) |
(full-re (and do-full (not ido-enable-regexp) (not (string-match "\$\\'" re)) |
2824 |
(concat "\\`" re "\\'"))) |
(concat "\\`" re "\\'"))) |
3372 |
;; 1. It prints a default file name when there is no text yet entered. |
;; 1. It prints a default file name when there is no text yet entered. |
3373 |
;; 2. It calls my completion routine rather than the standard completion. |
;; 2. It calls my completion routine rather than the standard completion. |
3374 |
|
|
3375 |
(if (= ido-use-mycompletion-depth (minibuffer-depth)) |
(when (= ido-use-mycompletion-depth (minibuffer-depth)) |
3376 |
(let ((contents (buffer-substring-no-properties (minibuffer-prompt-end) (point-max))) |
(let ((contents (buffer-substring-no-properties (minibuffer-prompt-end) (point-max))) |
3377 |
(buffer-undo-list t) |
(buffer-undo-list t) |
3378 |
try-single-dir-match) |
try-single-dir-match |
3379 |
|
refresh) |
3380 |
(ido-trace "\nexhibit" this-command) |
|
3381 |
(ido-trace "dir" ido-current-directory) |
(ido-trace "\nexhibit" this-command) |
3382 |
(ido-trace "contents" contents) |
(ido-trace "dir" ido-current-directory) |
3383 |
(ido-trace "list" ido-cur-list) |
(ido-trace "contents" contents) |
3384 |
(ido-trace "matches" ido-matches) |
(ido-trace "list" ido-cur-list) |
3385 |
(ido-trace "rescan" ido-rescan) |
(ido-trace "matches" ido-matches) |
3386 |
|
(ido-trace "rescan" ido-rescan) |
3387 |
|
|
3388 |
(save-excursion |
(save-excursion |
3389 |
(goto-char (point-max)) |
(goto-char (point-max)) |
3390 |
;; Register the end of input, so we know where the extra stuff (match-status info) begins: |
;; Register the end of input, so we know where the extra stuff (match-status info) begins: |
3391 |
(if (not (boundp 'ido-eoinput)) |
(unless (boundp 'ido-eoinput) |
3392 |
;; In case it got wiped out by major mode business: |
;; In case it got wiped out by major mode business: |
3393 |
(make-local-variable 'ido-eoinput)) |
(make-local-variable 'ido-eoinput)) |
3394 |
(setq ido-eoinput (point)) |
(setq ido-eoinput (point)) |
3395 |
|
|
3396 |
;; Handle explicit directory changes |
;; Handle explicit directory changes |
3397 |
(and |
(cond |
3398 |
(memq ido-cur-item '(file dir)) |
((eq ido-cur-item 'buffer) |
3399 |
(> (length contents) 1) |
) |
3400 |
(cond |
|
3401 |
((ido-final-slash contents) ;; xxx/ |
((= (length contents) 0) |
3402 |
(ido-trace "final slash" contents) |
) |
3403 |
(cond |
|
3404 |
((string-equal contents "~/") |
((= (length contents) 1) |
3405 |
(ido-set-current-home) |
(when (and (ido-is-tramp-root) (string-equal contents "/")) |
3406 |
t) |
(ido-set-current-directory ido-current-directory contents) |
3407 |
((string-equal contents "../") |
(setq refresh t)) |
3408 |
(ido-up-directory t) |
) |
3409 |
t) |
|
3410 |
((string-equal contents "./") |
((and (string-match (if ido-enable-tramp-completion "..[:@]\\'" "..:\\'") contents) |
3411 |
t) |
(ido-is-root-directory)) ;; Ange-ftp or tramp |
3412 |
((string-match contents "\\`~[a-zA-Z0-9]/\\'") |
(ido-set-current-directory ido-current-directory contents) |
3413 |
(ido-set-current-home contents) |
(when (ido-is-slow-ftp-host) |
3414 |
t) |
(setq ido-exit 'fallback) |
3415 |
((string-match "[$][A-Za-z0-9_]+/\\'" contents) |
(exit-minibuffer)) |
3416 |
(let ((exp (condition-case () |
(setq refresh t)) |
3417 |
(expand-file-name |
|
3418 |
(substitute-in-file-name (substring contents 0 -1)) |
((ido-final-slash contents) ;; xxx/ |
3419 |
ido-current-directory) |
(ido-trace "final slash" contents) |
3420 |
(error nil)))) |
(cond |
3421 |
(ido-trace contents exp) |
((string-equal contents "~/") |
3422 |
(if (and exp (file-directory-p exp)) |
(ido-set-current-home) |
3423 |
(progn |
(setq refresh t)) |
3424 |
(ido-set-current-directory (file-name-directory exp)) |
((string-equal contents "../") |
3425 |
(setq ido-text-init (file-name-nondirectory exp)) |
(ido-up-directory t) |
3426 |
t) |
(setq refresh t)) |
3427 |
nil))) |
((string-equal contents "./") |
3428 |
((and (memq system-type '(windows-nt ms-dos)) |
(setq refresh t)) |
3429 |
(string-equal (substring contents 1) ":/")) |
((string-match "\\`~[a-zA-Z0-9]+/\\'" contents) |
3430 |
(ido-set-current-directory (file-name-directory contents)) |
(ido-trace "new home" contents) |
3431 |
t) |
(ido-set-current-home contents) |
3432 |
((string-equal (substring contents -2 -1) "/") |
(setq refresh t)) |
3433 |
(ido-set-current-directory |
((string-match "[$][A-Za-z0-9_]+/\\'" contents) |
3434 |
(if (memq system-type '(windows-nt ms-dos)) |
(let ((exp (condition-case () |
3435 |
(expand-file-name "/" ido-current-directory) |
(expand-file-name |
3436 |
"/")) |
(substitute-in-file-name (substring contents 0 -1)) |
3437 |
t) |
ido-current-directory) |
3438 |
(t |
(error nil)))) |
3439 |
(setq try-single-dir-match t) |
(ido-trace contents exp) |
3440 |
nil))) |
(when (and exp (file-directory-p exp)) |
3441 |
|
(ido-set-current-directory (file-name-directory exp)) |
3442 |
((and (string-equal ido-current-directory "/") |
(setq ido-text-init (file-name-nondirectory exp)) |
3443 |
(string-match "..:\\'" contents)) ;; Ange-ftp |
(setq refresh t)))) |
3444 |
(ido-set-current-directory "/" contents) |
((and (memq system-type '(windows-nt ms-dos)) |
3445 |
(when (ido-is-slow-ftp-host) |
(string-equal (substring contents 1) ":/")) |
3446 |
(setq ido-exit 'fallback) |
(ido-set-current-directory (file-name-directory contents)) |
3447 |
(exit-minibuffer)) |
(setq refresh t)) |
3448 |
t) |
((string-equal (substring contents -2 -1) "/") |
|
|
|
|
((and (string-equal (substring contents -2 -1) "/") |
|
|
(not (string-match "[$]" contents))) |
|
|
(ido-set-current-directory |
|
|
(cond |
|
|
((= (length contents) 2) |
|
|
"/") |
|
|
(ido-matches |
|
|
(concat ido-current-directory (car ido-matches))) |
|
|
(t |
|
|
(concat ido-current-directory (substring contents 0 -1))))) |
|
|
(setq ido-text-init (substring contents -1)) |
|
|
t) |
|
|
|
|
|
((and (not ido-use-merged-list) |
|
|
(not (ido-final-slash contents)) |
|
|
(eq ido-try-merged-list t) |
|
|
(numberp ido-auto-merge-work-directories-length) |
|
|
(> ido-auto-merge-work-directories-length 0) |
|
|
(= (length contents) ido-auto-merge-work-directories-length) |
|
|
(not (and ido-auto-merge-inhibit-characters-regexp |
|
|
(string-match ido-auto-merge-inhibit-characters-regexp contents))) |
|
|
(not (input-pending-p))) |
|
|
(setq ido-use-merged-list 'auto |
|
|
ido-text-init contents |
|
|
ido-rotate-temp t) |
|
|
t)) |
|
|
(progn |
|
|
(ido-trace "refresh on /" ido-text-init) |
|
|
(setq ido-exit 'refresh) |
|
|
(exit-minibuffer))) |
|
|
|
|
|
;; Update the list of matches |
|
|
(setq ido-text contents) |
|
|
(ido-set-matches) |
|
|
(ido-trace "new " ido-matches) |
|
|
|
|
|
(when (and ido-enter-single-matching-directory |
|
|
ido-matches |
|
|
(null (cdr ido-matches)) |
|
|
(ido-final-slash (car ido-matches)) |
|
|
(or try-single-dir-match |
|
|
(eq ido-enter-single-matching-directory t))) |
|
|
(ido-trace "single match" (car ido-matches)) |
|
3449 |
(ido-set-current-directory |
(ido-set-current-directory |
3450 |
|
(if (memq system-type '(windows-nt ms-dos)) |
3451 |
|
(expand-file-name "/" ido-current-directory) |
3452 |
|
"/")) |
3453 |
|
(setq refresh t)) |
3454 |
|
(t |
3455 |
|
(ido-trace "try single dir") |
3456 |
|
(setq try-single-dir-match t)))) |
3457 |
|
|
3458 |
|
((and (string-equal (substring contents -2 -1) "/") |
3459 |
|
(not (string-match "[$]" contents))) |
3460 |
|
(ido-set-current-directory |
3461 |
|
(cond |
3462 |
|
((= (length contents) 2) |
3463 |
|
"/") |
3464 |
|
(ido-matches |
3465 |
(concat ido-current-directory (car ido-matches))) |
(concat ido-current-directory (car ido-matches))) |
3466 |
(setq ido-exit 'refresh) |
(t |
3467 |
(exit-minibuffer)) |
(concat ido-current-directory (substring contents 0 -1))))) |
3468 |
|
(setq ido-text-init (substring contents -1)) |
3469 |
|
(setq refresh t)) |
3470 |
|
|
3471 |
|
((and (not ido-use-merged-list) |
3472 |
|
(not (ido-final-slash contents)) |
3473 |
|
(eq ido-try-merged-list t) |
3474 |
|
(numberp ido-auto-merge-work-directories-length) |
3475 |
|
(> ido-auto-merge-work-directories-length 0) |
3476 |
|
(= (length contents) ido-auto-merge-work-directories-length) |
3477 |
|
(not (and ido-auto-merge-inhibit-characters-regexp |
3478 |
|
(string-match ido-auto-merge-inhibit-characters-regexp contents))) |
3479 |
|
(not (input-pending-p))) |
3480 |
|
(setq ido-use-merged-list 'auto |
3481 |
|
ido-text-init contents |
3482 |
|
ido-rotate-temp t) |
3483 |
|
(setq refresh t)) |
3484 |
|
|
3485 |
|
(t nil)) |
3486 |
|
|
3487 |
|
(when refresh |
3488 |
|
(ido-trace "refresh on /" ido-text-init) |
3489 |
|
(setq ido-exit 'refresh) |
3490 |
|
(exit-minibuffer)) |
3491 |
|
|
3492 |
|
;; Update the list of matches |
3493 |
|
(setq ido-text contents) |
3494 |
|
(ido-set-matches) |
3495 |
|
(ido-trace "new " ido-matches) |
3496 |
|
|
3497 |
|
(when (and ido-enter-single-matching-directory |
3498 |
|
ido-matches |
3499 |
|
(null (cdr ido-matches)) |
3500 |
|
(ido-final-slash (car ido-matches)) |
3501 |
|
(or try-single-dir-match |
3502 |
|
(eq ido-enter-single-matching-directory t))) |
3503 |
|
(ido-trace "single match" (car ido-matches)) |
3504 |
|
(ido-set-current-directory |
3505 |
|
(concat ido-current-directory (car ido-matches))) |
3506 |
|
(setq ido-exit 'refresh) |
3507 |
|
(exit-minibuffer)) |
3508 |
|
|
3509 |
(when (and (not ido-matches) |
(when (and (not ido-matches) |
3510 |
; ido-rescan |
;; ido-rescan ? |
3511 |
ido-process-ignore-lists |
ido-process-ignore-lists |
3512 |
ido-ignored-list) |
ido-ignored-list) |
3513 |
(let ((ido-process-ignore-lists nil) |
(let ((ido-process-ignore-lists nil) |
3514 |
(ido-rotate ido-rotate) |
(ido-rotate ido-rotate) |
3515 |
(ido-cur-list ido-ignored-list)) |
(ido-cur-list ido-ignored-list)) |
3516 |
(ido-trace "try all" ido-ignored-list) |
(ido-trace "try all" ido-ignored-list) |
3517 |
(ido-set-matches)) |
(ido-set-matches)) |
3518 |
(when ido-matches |
(when ido-matches |
3519 |
(ido-trace "found " ido-matches) |
(ido-trace "found " ido-matches) |
3520 |
(setq ido-rescan t) |
(setq ido-rescan t) |
3521 |
(setq ido-process-ignore-lists-inhibit t) |
(setq ido-process-ignore-lists-inhibit t) |
3522 |
(setq ido-text-init ido-text) |
(setq ido-text-init ido-text) |
3523 |
(setq ido-exit 'refresh) |
(setq ido-exit 'refresh) |
3524 |
(exit-minibuffer))) |
(exit-minibuffer))) |
|
|
|
|
(when (and |
|
|
ido-rescan |
|
|
(not ido-matches) |
|
|
(memq ido-cur-item '(file dir)) |
|
|
(not (ido-is-root-directory)) |
|
|
(> (length contents) 1) |
|
|
(not (string-match "[$]" contents))) |
|
|
(ido-trace "merge?") |
|
|
(if ido-use-merged-list |
|
|
(ido-undo-merge-work-directory contents nil) |
|
|
(when (and (eq ido-try-merged-list t) |
|
|
(numberp ido-auto-merge-work-directories-length) |
|
|
(= ido-auto-merge-work-directories-length 0) |
|
|
(not (and ido-auto-merge-inhibit-characters-regexp |
|
|
(string-match ido-auto-merge-inhibit-characters-regexp contents))) |
|
|
(not (input-pending-p))) |
|
|
(ido-trace "\n*start timer*") |
|
|
(setq ido-auto-merge-timer |
|
|
(run-with-timer ido-auto-merge-delay-time nil 'ido-initiate-auto-merge (current-buffer)))))) |
|
|
|
|
|
(setq ido-rescan t) |
|
3525 |
|
|
3526 |
(if (and ido-use-merged-list |
(when (and |
3527 |
ido-matches |
ido-rescan |
3528 |
(not (string-equal (car (cdr (car ido-matches))) ido-current-directory))) |
(not ido-matches) |
3529 |
(progn |
(memq ido-cur-item '(file dir)) |
3530 |
(ido-set-current-directory (car (cdr (car ido-matches)))) |
(not (ido-is-root-directory)) |
3531 |
(setq ido-use-merged-list t |
(> (length contents) 1) |
3532 |
ido-exit 'keep |
(not (string-match "[$]" contents))) |
3533 |
ido-text-init ido-text) |
(ido-trace "merge?") |
3534 |
(exit-minibuffer))) |
(if ido-use-merged-list |
3535 |
|
(ido-undo-merge-work-directory contents nil) |
3536 |
;; Insert the match-status information: |
(when (and (eq ido-try-merged-list t) |
3537 |
(ido-set-common-completion) |
(numberp ido-auto-merge-work-directories-length) |
3538 |
(let ((inf (ido-completions |
(= ido-auto-merge-work-directories-length 0) |
3539 |
contents |
(not (and ido-auto-merge-inhibit-characters-regexp |
3540 |
minibuffer-completion-table |
(string-match ido-auto-merge-inhibit-characters-regexp contents))) |
3541 |
minibuffer-completion-predicate |
(not (input-pending-p))) |
3542 |
(not minibuffer-completion-confirm)))) |
(ido-trace "\n*start timer*") |
3543 |
(ido-trace "inf" inf) |
(setq ido-auto-merge-timer |
3544 |
(insert inf)) |
(run-with-timer ido-auto-merge-delay-time nil 'ido-initiate-auto-merge (current-buffer)))))) |
3545 |
|
|
3546 |
)))) |
(setq ido-rescan t) |
3547 |
|
|
3548 |
|
(if (and ido-use-merged-list |
3549 |
|
ido-matches |
3550 |
|
(not (string-equal (car (cdr (car ido-matches))) ido-current-directory))) |
3551 |
|
(progn |
3552 |
|
(ido-set-current-directory (car (cdr (car ido-matches)))) |
3553 |
|
(setq ido-use-merged-list t |
3554 |
|
ido-exit 'keep |
3555 |
|
ido-text-init ido-text) |
3556 |
|
(exit-minibuffer))) |
3557 |
|
|
3558 |
|
;; Insert the match-status information: |
3559 |
|
(ido-set-common-completion) |
3560 |
|
(let ((inf (ido-completions |
3561 |
|
contents |
3562 |
|
minibuffer-completion-table |
3563 |
|
minibuffer-completion-predicate |
3564 |
|
(not minibuffer-completion-confirm)))) |
3565 |
|
(ido-trace "inf" inf) |
3566 |
|
(insert inf)) |
3567 |
|
)))) |
3568 |
|
|
3569 |
(defun ido-completions (name candidates predicate require-match) |
(defun ido-completions (name candidates predicate require-match) |
3570 |
;; Return the string that is displayed after the user's text. |
;; Return the string that is displayed after the user's text. |