Mercurial > emacs
comparison lisp/ido.el @ 90180:62afea0771d8
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-51
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 289-301)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 68)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 12 May 2005 03:41:19 +0000 |
parents | 08185296b491 e002770fe3ac |
children | f042e7c0fe20 |
comparison
equal
deleted
inserted
replaced
90179:b745036dab36 | 90180:62afea0771d8 |
---|---|
249 ;; Customization | 249 ;; Customization |
250 ;; ------------- | 250 ;; ------------- |
251 ;; | 251 ;; |
252 ;; Customize the `ido' group to change the `ido' functionality. | 252 ;; Customize the `ido' group to change the `ido' functionality. |
253 ;; | 253 ;; |
254 ;; To modify the keybindings, use the hook provided. For example: | 254 ;; To modify the keybindings, use the ido-setup-hook. For example: |
255 ;;(add-hook 'ido-define-mode-map-hook 'ido-my-keys) | 255 ;;(add-hook 'ido-setup-hook 'ido-my-keys) |
256 ;; | 256 ;; |
257 ;;(defun ido-my-keys () | 257 ;;(defun ido-my-keys () |
258 ;; "Add my keybindings for ido." | 258 ;; "Add my keybindings for ido." |
259 ;; (define-key ido-mode-map " " 'ido-next-match) | 259 ;; (define-key ido-mode-map " " 'ido-next-match) |
260 ;; ) | 260 ;; ) |
703 :type '(choice (const always) | 703 :type '(choice (const always) |
704 (const prompt) | 704 (const prompt) |
705 (const never)) | 705 (const never)) |
706 :group 'ido) | 706 :group 'ido) |
707 | 707 |
708 (defcustom ido-define-mode-map-hook nil | 708 (defcustom ido-setup-hook nil |
709 "*Hook to define keys in `ido-mode-map' for extra keybindings." | 709 "*Hook run after the ido variables and keymap has been setup. |
710 The dynamic variable `ido-cur-item' contains the current type of item that | |
711 is read by ido, possible values are file, dir, buffer, and list. | |
712 Additional keys can be defined in `ido-mode-map'." | |
710 :type 'hook | 713 :type 'hook |
711 :group 'ido) | 714 :group 'ido) |
712 | 715 |
713 (defcustom ido-separator nil | 716 (defcustom ido-separator nil |
714 "*String used by ido to separate the alternatives in the minibuffer. | 717 "*String used by ido to separate the alternatives in the minibuffer. |
928 (defvar ido-text nil | 931 (defvar ido-text nil |
929 "Stores the users string as it is typed in.") | 932 "Stores the users string as it is typed in.") |
930 | 933 |
931 (defvar ido-text-init nil | 934 (defvar ido-text-init nil |
932 "The initial string for the users string it is typed in.") | 935 "The initial string for the users string it is typed in.") |
936 | |
937 (defvar ido-input-stack nil | |
938 "Stores the users strings when user hits M-b/M-f.") | |
933 | 939 |
934 (defvar ido-matches nil | 940 (defvar ido-matches nil |
935 "List of files currently matching `ido-text'.") | 941 "List of files currently matching `ido-text'.") |
936 | 942 |
937 (defvar ido-report-no-match t | 943 (defvar ido-report-no-match t |
1397 (define-key map [backspace] 'ido-delete-backward-updir) | 1403 (define-key map [backspace] 'ido-delete-backward-updir) |
1398 (define-key map "\d" 'ido-delete-backward-updir) | 1404 (define-key map "\d" 'ido-delete-backward-updir) |
1399 (define-key map [(meta backspace)] 'ido-delete-backward-word-updir) | 1405 (define-key map [(meta backspace)] 'ido-delete-backward-word-updir) |
1400 (define-key map [(control backspace)] 'ido-up-directory) | 1406 (define-key map [(control backspace)] 'ido-up-directory) |
1401 (define-key map "\C-l" 'ido-reread-directory) | 1407 (define-key map "\C-l" 'ido-reread-directory) |
1402 (define-key map [(meta ?b)] 'ido-next-work-file) | |
1403 (define-key map [(meta ?d)] 'ido-wide-find-dir) | 1408 (define-key map [(meta ?d)] 'ido-wide-find-dir) |
1404 (define-key map [(meta ?f)] 'ido-wide-find-file) | 1409 (define-key map [(meta ?b)] 'ido-push-dir) |
1410 (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir) | |
1405 (define-key map [(meta ?k)] 'ido-forget-work-directory) | 1411 (define-key map [(meta ?k)] 'ido-forget-work-directory) |
1406 (define-key map [(meta ?m)] 'ido-make-directory) | 1412 (define-key map [(meta ?m)] 'ido-make-directory) |
1407 (define-key map [(meta ?n)] 'ido-next-work-directory) | 1413 (define-key map [(meta ?n)] 'ido-next-work-directory) |
1408 (define-key map [(meta ?o)] 'ido-prev-work-file) | 1414 (define-key map [(meta ?o)] 'ido-prev-work-file) |
1415 (define-key map [(meta ?O)] 'ido-next-work-file) | |
1409 (define-key map [(meta ?p)] 'ido-prev-work-directory) | 1416 (define-key map [(meta ?p)] 'ido-prev-work-directory) |
1410 (define-key map [(meta ?s)] 'ido-merge-work-directories) | 1417 (define-key map [(meta ?s)] 'ido-merge-work-directories) |
1411 ) | 1418 ) |
1412 | 1419 |
1413 (when (eq ido-cur-item 'file) | 1420 (when (eq ido-cur-item 'file) |
1429 (when (memq ido-cur-item '(file dir)) | 1436 (when (memq ido-cur-item '(file dir)) |
1430 (define-key map [remap viper-backward-char] 'ido-delete-backward-updir) | 1437 (define-key map [remap viper-backward-char] 'ido-delete-backward-updir) |
1431 (define-key map [remap viper-del-backward-char-in-insert] 'ido-delete-backward-updir) | 1438 (define-key map [remap viper-del-backward-char-in-insert] 'ido-delete-backward-updir) |
1432 (define-key map [remap viper-delete-backward-word] 'ido-delete-backward-word-updir))) | 1439 (define-key map [remap viper-delete-backward-word] 'ido-delete-backward-word-updir))) |
1433 | 1440 |
1434 (setq ido-mode-map map) | 1441 (setq ido-mode-map map))) |
1435 (run-hooks 'ido-define-mode-map-hook))) | |
1436 | 1442 |
1437 (defun ido-final-slash (dir &optional fix-it) | 1443 (defun ido-final-slash (dir &optional fix-it) |
1438 ;; return DIR if DIR has final slash. | 1444 ;; return DIR if DIR has final slash. |
1439 ;; else if FIX-IT is non-nil, return DIR/ | 1445 ;; else if FIX-IT is non-nil, return DIR/ |
1440 ;; else return nil. | 1446 ;; else return nil. |
1599 (ido-enable-regexp ido-enable-regexp) | 1605 (ido-enable-regexp ido-enable-regexp) |
1600 ) | 1606 ) |
1601 | 1607 |
1602 (ido-define-mode-map) | 1608 (ido-define-mode-map) |
1603 (setq ido-text-init initial) | 1609 (setq ido-text-init initial) |
1610 (setq ido-input-stack nil) | |
1611 | |
1612 (run-hooks 'ido-setup-hook) | |
1613 | |
1604 (while (not done) | 1614 (while (not done) |
1605 (ido-trace "\n_LOOP_" ido-text-init) | 1615 (ido-trace "\n_LOOP_" ido-text-init) |
1606 (setq ido-exit nil) | 1616 (setq ido-exit nil) |
1607 (setq ido-rescan t) | 1617 (setq ido-rescan t) |
1608 (setq ido-rotate nil) | 1618 (setq ido-rotate nil) |
1740 (f ido-text-init) | 1750 (f ido-text-init) |
1741 (new t)) | 1751 (new t)) |
1742 (setq ido-text-init "") | 1752 (setq ido-text-init "") |
1743 (while new | 1753 (while new |
1744 (setq new (if edit | 1754 (setq new (if edit |
1745 (read-file-name (concat prompt "[EDIT] ") | 1755 (condition-case nil |
1746 (expand-file-name d) | 1756 (read-file-name (concat prompt "[EDIT] ") |
1747 (concat d f) nil f) | 1757 (expand-file-name d) |
1758 (concat d f) nil f) | |
1759 (quit (concat d f))) | |
1748 f) | 1760 f) |
1749 d (or (file-name-directory new) "/") | 1761 d (or (file-name-directory new) "/") |
1750 f (file-name-nondirectory new) | 1762 f (file-name-nondirectory new) |
1751 edit t) | 1763 edit t) |
1752 (if (or | 1764 (if (or |
1761 (progn | 1773 (progn |
1762 (ido-set-current-directory d nil (eq ido-exit 'chdir)) | 1774 (ido-set-current-directory d nil (eq ido-exit 'chdir)) |
1763 (setq ido-text-init f | 1775 (setq ido-text-init f |
1764 new nil)))))) | 1776 new nil)))))) |
1765 (t | 1777 (t |
1766 (setq ido-text-init (read-string (concat prompt "[EDIT] ") ido-final-text)))) | 1778 (setq ido-text-init |
1779 (condition-case nil | |
1780 (read-string (concat prompt "[EDIT] ") ido-final-text) | |
1781 (quit ido-final-text))))) | |
1782 | |
1767 nil) | 1783 nil) |
1768 | 1784 |
1769 ((eq ido-exit 'keep) | 1785 ((eq ido-exit 'keep) |
1770 (setq ido-keep-item-list t)) | 1786 (setq ido-keep-item-list t)) |
1771 | 1787 |
1772 ((memq ido-exit '(dired fallback find-file switch-to-buffer insert-buffer insert-file)) | 1788 ((memq ido-exit '(dired fallback find-file switch-to-buffer insert-buffer insert-file)) |
1773 (setq done t)) | 1789 (setq done t)) |
1774 | 1790 |
1775 ((eq ido-exit 'updir) | 1791 ((memq ido-exit '(updir push)) |
1776 ;; cannot go up if already at the root-dir (Unix) or at the | 1792 ;; cannot go up if already at the root-dir (Unix) or at the |
1777 ;; root-dir of a certain drive (Windows or MS-DOS). | 1793 ;; root-dir of a certain drive (Windows or MS-DOS). |
1778 (if (ido-is-tramp-root) | 1794 (if (ido-is-tramp-root) |
1779 (when (string-match "\\`\\(/\\([^/]+[:@]\\)*\\)\\([^/]+\\)[:@]\\'" ido-current-directory) | 1795 (when (string-match "\\`\\(/\\([^/]+[:@]\\)*\\)\\([^/]+\\)[:@]\\'" ido-current-directory) |
1780 (setq ido-text-init (match-string 3 ido-current-directory)) | 1796 (setq ido-text-init (match-string 3 ido-current-directory)) |
1781 (ido-set-current-directory (match-string 1 ido-current-directory)) | 1797 (ido-set-current-directory (match-string 1 ido-current-directory)) |
1782 (setq ido-set-default-item t)) | 1798 (setq ido-set-default-item t)) |
1783 (unless (ido-is-root-directory) | 1799 (unless (ido-is-root-directory) |
1800 (when (eq ido-exit 'push) | |
1801 (setq ido-input-stack (cons (cons ido-cur-item ido-text) ido-input-stack)) | |
1802 (setq ido-cur-item 'dir) | |
1803 (setq ido-text-init (file-name-nondirectory (substring ido-current-directory 0 -1))) | |
1804 (ido-trace "push" ido-input-stack)) | |
1784 (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1))) | 1805 (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1))) |
1785 (setq ido-set-default-item t)))) | 1806 (setq ido-set-default-item t)))) |
1807 | |
1808 ((eq ido-exit 'pop) | |
1809 (ido-trace "pop" ido-input-stack) | |
1810 (let ((elt (car ido-input-stack))) | |
1811 (setq ido-input-stack (cdr ido-input-stack)) | |
1812 (ido-set-current-directory (concat ido-current-directory ido-text)) | |
1813 (setq ido-cur-item (car elt)) | |
1814 (setq ido-text-init (cdr elt)))) | |
1815 | |
1816 ((eq ido-exit 'pop-all) | |
1817 (ido-trace "pop-all" ido-input-stack) | |
1818 (while ido-input-stack | |
1819 (let ((elt (car ido-input-stack))) | |
1820 (setq ido-input-stack (cdr ido-input-stack)) | |
1821 (ido-set-current-directory (concat ido-current-directory ido-text)) | |
1822 (setq ido-cur-item (car elt)) | |
1823 (setq ido-text-init (cdr elt))))) | |
1786 | 1824 |
1787 ;; Handling the require-match must be done in a better way. | 1825 ;; Handling the require-match must be done in a better way. |
1788 ((and require-match | 1826 ((and require-match |
1789 (not (if ido-directory-too-big | 1827 (not (if ido-directory-too-big |
1790 (file-exists-p (concat ido-current-directory ido-final-text)) | 1828 (file-exists-p (concat ido-current-directory ido-final-text)) |
1836 (if x | 1874 (if x |
1837 (setcdr x ido-selected) | 1875 (setcdr x ido-selected) |
1838 (setq ido-last-directory-list | 1876 (setq ido-last-directory-list |
1839 (cons (cons ido-current-directory ido-selected) ido-last-directory-list))))) | 1877 (cons (cons ido-current-directory ido-selected) ido-last-directory-list))))) |
1840 (ido-set-current-directory ido-current-directory ido-selected) | 1878 (ido-set-current-directory ido-current-directory ido-selected) |
1841 (setq ido-set-default-item t)) | 1879 (if ido-input-stack |
1880 (while ido-input-stack | |
1881 (let ((elt (car ido-input-stack))) | |
1882 (if (setq ido-input-stack (cdr ido-input-stack)) | |
1883 (ido-set-current-directory ido-current-directory (cdr elt)) | |
1884 (setq ido-text-init (cdr elt))) | |
1885 (setq ido-cur-item (car elt)))) | |
1886 (setq ido-set-default-item t))) | |
1842 | 1887 |
1843 (t | 1888 (t |
1844 (setq done t)))))) | 1889 (setq done t)))))) |
1845 ido-selected)) | 1890 ido-selected)) |
1846 | 1891 |
1966 (or ido-use-url-at-point ido-use-filename-at-point)) | 2011 (or ido-use-url-at-point ido-use-filename-at-point)) |
1967 (let (fn d) | 2012 (let (fn d) |
1968 (require 'ffap) | 2013 (require 'ffap) |
1969 ;; Duplicate code from ffap-guesser as we want different behaviour for files and URLs. | 2014 ;; Duplicate code from ffap-guesser as we want different behaviour for files and URLs. |
1970 (cond | 2015 (cond |
1971 ((and ido-use-url-at-point | 2016 ((with-no-warnings |
1972 ffap-url-regexp | 2017 (and ido-use-url-at-point |
1973 (ffap-fixup-url (or (ffap-url-at-point) | 2018 ffap-url-regexp |
1974 (ffap-gopher-at-point)))) | 2019 (ffap-fixup-url (or (ffap-url-at-point) |
2020 (ffap-gopher-at-point))))) | |
1975 (setq ido-exit 'ffap | 2021 (setq ido-exit 'ffap |
1976 filename t)) | 2022 filename t)) |
1977 | 2023 |
1978 ((and ido-use-filename-at-point | 2024 ((and ido-use-filename-at-point |
1979 (setq fn (ffap-string-at-point)) | 2025 (setq fn (ffap-string-at-point)) |
2039 ((file-exists-p file) | 2085 ((file-exists-p file) |
2040 (ido-record-command method ido-current-directory) | 2086 (ido-record-command method ido-current-directory) |
2041 (ido-record-work-directory) | 2087 (ido-record-work-directory) |
2042 (funcall method ido-current-directory) | 2088 (funcall method ido-current-directory) |
2043 (if (eq method 'dired) | 2089 (if (eq method 'dired) |
2044 (dired-goto-file (expand-file-name file)))) | 2090 (with-no-warnings |
2091 (dired-goto-file (expand-file-name file))))) | |
2045 ((string-match "[[*?]" filename) | 2092 ((string-match "[[*?]" filename) |
2046 (setq dirname (concat ido-current-directory filename)) | 2093 (setq dirname (concat ido-current-directory filename)) |
2047 (ido-record-command method dirname) | 2094 (ido-record-command method dirname) |
2048 (ido-record-work-directory) | 2095 (ido-record-work-directory) |
2049 (funcall method dirname)) | 2096 (funcall method dirname)) |
2281 (defun ido-exit-minibuffer () | 2328 (defun ido-exit-minibuffer () |
2282 "Exit minibuffer, but make sure we have a match if one is needed." | 2329 "Exit minibuffer, but make sure we have a match if one is needed." |
2283 (interactive) | 2330 (interactive) |
2284 (if (or (not ido-require-match) | 2331 (if (or (not ido-require-match) |
2285 (ido-existing-item-p)) | 2332 (ido-existing-item-p)) |
2286 (throw 'exit nil))) | 2333 (exit-minibuffer))) |
2287 | 2334 |
2288 (defun ido-select-text () | 2335 (defun ido-select-text () |
2289 "Select the buffer or file named by the prompt. | 2336 "Select the buffer or file named by the prompt. |
2290 If no buffer or file exactly matching the prompt exists, maybe create a new one." | 2337 If no buffer or file exactly matching the prompt exists, maybe create a new one." |
2291 (interactive) | 2338 (interactive) |
2430 "Prompt for FILE to search for using find, starting from current directory." | 2477 "Prompt for FILE to search for using find, starting from current directory." |
2431 (interactive) | 2478 (interactive) |
2432 (unless file | 2479 (unless file |
2433 (let ((enable-recursive-minibuffers t)) | 2480 (let ((enable-recursive-minibuffers t)) |
2434 (setq file | 2481 (setq file |
2435 (read-string (concat "Wide find file: " ido-current-directory) ido-text)))) | 2482 (condition-case nil |
2483 (read-string (concat "Wide find file: " ido-current-directory) ido-text) | |
2484 (quit ""))))) | |
2436 (when (> (length file) 0) | 2485 (when (> (length file) 0) |
2437 (setq ido-use-merged-list t ido-try-merged-list 'wide) | 2486 (setq ido-use-merged-list t ido-try-merged-list 'wide) |
2438 (setq ido-exit 'refresh) | 2487 (setq ido-exit 'refresh) |
2439 (setq ido-text-init file) | 2488 (setq ido-text-init file) |
2440 (setq ido-rotate-temp t) | 2489 (setq ido-rotate-temp t) |
2444 "Prompt for DIR to search for using find, starting from current directory." | 2493 "Prompt for DIR to search for using find, starting from current directory." |
2445 (interactive) | 2494 (interactive) |
2446 (unless dir | 2495 (unless dir |
2447 (let ((enable-recursive-minibuffers t)) | 2496 (let ((enable-recursive-minibuffers t)) |
2448 (setq dir | 2497 (setq dir |
2449 (read-string (concat "Wide find directory: " ido-current-directory) ido-text)))) | 2498 (condition-case nil |
2499 (read-string (concat "Wide find directory: " ido-current-directory) ido-text) | |
2500 (quit ""))))) | |
2450 (when (> (length dir) 0) | 2501 (when (> (length dir) 0) |
2451 (setq ido-use-merged-list t ido-try-merged-list 'wide) | 2502 (setq ido-use-merged-list t ido-try-merged-list 'wide) |
2452 (setq ido-exit 'refresh) | 2503 (setq ido-exit 'refresh) |
2453 (setq ido-text-init (ido-final-slash dir t)) | 2504 (setq ido-text-init (ido-final-slash dir t)) |
2454 (setq ido-rotate-temp t) | 2505 (setq ido-rotate-temp t) |
2455 (exit-minibuffer))) | 2506 (exit-minibuffer))) |
2507 | |
2508 (defun ido-push-dir () | |
2509 "Move to previous directory in file name, push current input on stack." | |
2510 (interactive) | |
2511 (setq ido-exit 'push) | |
2512 (exit-minibuffer)) | |
2513 | |
2514 (defun ido-pop-dir (arg) | |
2515 "Pop directory from input stack back to input. | |
2516 With \\[universal-argument], pop all element." | |
2517 (interactive "P") | |
2518 (when ido-input-stack | |
2519 (setq ido-exit (if arg 'pop-all 'pop)) | |
2520 (exit-minibuffer))) | |
2521 | |
2522 (defun ido-wide-find-file-or-pop-dir (arg) | |
2523 (interactive "P") | |
2524 (if ido-input-stack | |
2525 (ido-pop-dir arg) | |
2526 (ido-wide-find-file))) | |
2456 | 2527 |
2457 (defun ido-make-directory (&optional dir) | 2528 (defun ido-make-directory (&optional dir) |
2458 "Prompt for DIR to create in current directory." | 2529 "Prompt for DIR to create in current directory." |
2459 (interactive) | 2530 (interactive) |
2460 (unless dir | 2531 (unless dir |
2769 res)) | 2840 res)) |
2770 | 2841 |
2771 (defun ido-make-merged-file-list (text auto wide) | 2842 (defun ido-make-merged-file-list (text auto wide) |
2772 (let (res) | 2843 (let (res) |
2773 (message "Searching for `%s'...." text) | 2844 (message "Searching for `%s'...." text) |
2774 (if (and (ido-final-slash text) ido-dir-file-cache) | 2845 (condition-case nil |
2775 (if wide | 2846 (if (and (ido-final-slash text) ido-dir-file-cache) |
2776 (setq res (ido-wide-find-dirs-or-files | 2847 (if wide |
2777 ido-current-directory (substring text 0 -1) ido-enable-prefix t)) | 2848 (setq res (ido-wide-find-dirs-or-files |
2778 ;; Use list of cached directories | 2849 ido-current-directory (substring text 0 -1) ido-enable-prefix t)) |
2779 (let ((re (concat (regexp-quote (substring text 0 -1)) "[^/:]*/\\'")) | 2850 ;; Use list of cached directories |
2780 (dirs ido-dir-file-cache) | 2851 (let ((re (concat (regexp-quote (substring text 0 -1)) "[^/:]*/\\'")) |
2781 dir b d f) | 2852 (dirs ido-dir-file-cache) |
2782 (if nil ;; simple | 2853 dir b d f) |
2783 (while dirs | 2854 (if nil ;; simple |
2784 (setq dir (car (car dirs)) | 2855 (while dirs |
2785 dirs (cdr dirs)) | 2856 (setq dir (car (car dirs)) |
2786 (when (and (string-match re dir) | 2857 dirs (cdr dirs)) |
2787 (not (ido-ignore-item-p dir ido-ignore-directories-merge)) | 2858 (when (and (string-match re dir) |
2788 (file-directory-p dir)) | 2859 (not (ido-ignore-item-p dir ido-ignore-directories-merge)) |
2789 (setq b (substring dir 0 -1) | 2860 (file-directory-p dir)) |
2790 f (concat (file-name-nondirectory b) "/") | 2861 (setq b (substring dir 0 -1) |
2791 d (file-name-directory b) | 2862 f (concat (file-name-nondirectory b) "/") |
2792 res (cons (cons f d) res)))) | 2863 d (file-name-directory b) |
2864 res (cons (cons f d) res)))) | |
2865 (while dirs | |
2866 (setq dir (car dirs) | |
2867 d (car dir) | |
2868 dirs (cdr dirs)) | |
2869 (when (not (ido-ignore-item-p d ido-ignore-directories-merge)) | |
2870 (setq dir (cdr (cdr dir))) | |
2871 (while dir | |
2872 (setq f (car dir) | |
2873 dir (cdr dir)) | |
2874 (if (and (string-match re f) | |
2875 (not (ido-ignore-item-p f ido-ignore-directories))) | |
2876 (setq res (cons (cons f d) res))))) | |
2877 (if (and auto (input-pending-p)) | |
2878 (setq dirs nil | |
2879 res t)))))) | |
2880 (if wide | |
2881 (setq res (ido-wide-find-dirs-or-files | |
2882 ido-current-directory text ido-enable-prefix nil)) | |
2883 (let ((ido-text text) | |
2884 (dirs ido-work-directory-list) | |
2885 (must-match (and text (> (length text) 0))) | |
2886 dir fl) | |
2887 (if (and auto (not (member ido-current-directory dirs))) | |
2888 (setq dirs (cons ido-current-directory dirs))) | |
2793 (while dirs | 2889 (while dirs |
2794 (setq dir (car dirs) | 2890 (setq dir (car dirs) |
2795 d (car dir) | |
2796 dirs (cdr dirs)) | 2891 dirs (cdr dirs)) |
2797 (when (not (ido-ignore-item-p d ido-ignore-directories-merge)) | 2892 (when (and dir (stringp dir) |
2798 (setq dir (cdr (cdr dir))) | 2893 (or ido-merge-ftp-work-directories |
2799 (while dir | 2894 (not (ido-is-ftp-directory dir))) |
2800 (setq f (car dir) | 2895 (file-directory-p dir) |
2801 dir (cdr dir)) | 2896 ;; TODO. check for nonreadable and too-big. |
2802 (if (and (string-match re f) | 2897 (setq fl (if (eq ido-cur-item 'file) |
2803 (not (ido-ignore-item-p f ido-ignore-directories))) | 2898 (ido-make-file-list1 dir t) |
2804 (setq res (cons (cons f d) res))))) | 2899 (ido-make-dir-list1 dir t)))) |
2900 (if must-match | |
2901 (setq fl (ido-set-matches1 fl))) | |
2902 (if fl | |
2903 (setq res (nconc fl res)))) | |
2805 (if (and auto (input-pending-p)) | 2904 (if (and auto (input-pending-p)) |
2806 (setq dirs nil | 2905 (setq dirs nil |
2807 res t)))))) | 2906 res t)))))) |
2808 (if wide | 2907 (quit (setq res t))) |
2809 (setq res (ido-wide-find-dirs-or-files | |
2810 ido-current-directory text ido-enable-prefix nil)) | |
2811 (let ((ido-text text) | |
2812 (dirs ido-work-directory-list) | |
2813 (must-match (and text (> (length text) 0))) | |
2814 dir fl) | |
2815 (if (and auto (not (member ido-current-directory dirs))) | |
2816 (setq dirs (cons ido-current-directory dirs))) | |
2817 (while dirs | |
2818 (setq dir (car dirs) | |
2819 dirs (cdr dirs)) | |
2820 (when (and dir (stringp dir) | |
2821 (or ido-merge-ftp-work-directories | |
2822 (not (ido-is-ftp-directory dir))) | |
2823 (file-directory-p dir) | |
2824 ;; TODO. check for nonreadable and too-big. | |
2825 (setq fl (if (eq ido-cur-item 'file) | |
2826 (ido-make-file-list1 dir t) | |
2827 (ido-make-dir-list1 dir t)))) | |
2828 (if must-match | |
2829 (setq fl (ido-set-matches1 fl))) | |
2830 (if fl | |
2831 (setq res (nconc fl res)))) | |
2832 (if (and auto (input-pending-p)) | |
2833 (setq dirs nil | |
2834 res t)))))) | |
2835 (if (and res (not (eq res t))) | 2908 (if (and res (not (eq res t))) |
2836 (setq res (ido-sort-merged-list res auto))) | 2909 (setq res (ido-sort-merged-list res auto))) |
2837 (when (and (or ido-rotate-temp ido-rotate-file-list-default) | 2910 (when (and (or ido-rotate-temp ido-rotate-file-list-default) |
2838 (listp res) | 2911 (listp res) |
2839 (> (length text) 0)) | 2912 (> (length text) 0)) |
3061 (setq ido-temp-list | 3134 (setq ido-temp-list |
3062 (delete default ido-temp-list)) | 3135 (delete default ido-temp-list)) |
3063 (setq ido-temp-list | 3136 (setq ido-temp-list |
3064 (cons default ido-temp-list)))) | 3137 (cons default ido-temp-list)))) |
3065 (setq ido-temp-list (delete "." ido-temp-list)) | 3138 (setq ido-temp-list (delete "." ido-temp-list)) |
3066 (setq ido-temp-list (cons "." ido-temp-list)) | 3139 (unless ido-input-stack |
3140 (setq ido-temp-list (cons "." ido-temp-list))) | |
3067 (run-hooks 'ido-make-dir-list-hook) | 3141 (run-hooks 'ido-make-dir-list-hook) |
3068 ido-temp-list)) | 3142 ido-temp-list)) |
3069 | 3143 |
3070 ;; List of the files visible in the current frame. | 3144 ;; List of the files visible in the current frame. |
3071 (defvar ido-bufs-in-frame) | 3145 (defvar ido-bufs-in-frame) |
3263 (set-buffer temp-buf) | 3337 (set-buffer temp-buf) |
3264 (setq win (get-buffer-window temp-buf)) | 3338 (setq win (get-buffer-window temp-buf)) |
3265 (if (pos-visible-in-window-p (point-max) win) | 3339 (if (pos-visible-in-window-p (point-max) win) |
3266 (if (or ido-completion-buffer-all-completions (boundp 'ido-completion-buffer-full)) | 3340 (if (or ido-completion-buffer-all-completions (boundp 'ido-completion-buffer-full)) |
3267 (set-window-start win (point-min)) | 3341 (set-window-start win (point-min)) |
3268 (set (make-local-variable 'ido-completion-buffer-full) t) | 3342 (with-no-warnings |
3343 (set (make-local-variable 'ido-completion-buffer-full) t)) | |
3269 (setq full-list t | 3344 (setq full-list t |
3270 display-it t)) | 3345 display-it t)) |
3271 (scroll-other-window)) | 3346 (scroll-other-window)) |
3272 (set-buffer buf)) | 3347 (set-buffer buf)) |
3273 (setq display-it t)) | 3348 (setq display-it t)) |