Mercurial > emacs
comparison lisp/ido.el @ 90203:187d6a1f84f7
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-71
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 485-492)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 92-94)
- Merge from emacs--cvs-trunk--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 22 Jul 2005 08:27:27 +0000 |
parents | fbb2bea03df9 2b7f6da0c696 |
children | 2d92f5c9d6ae |
comparison
equal
deleted
inserted
replaced
90202:7597b4a23c3b | 90203:187d6a1f84f7 |
---|---|
99 ;; Buffer: 2[3]{123456,123} | 99 ;; Buffer: 2[3]{123456,123} |
100 ;; | 100 ;; |
101 ;; The list in {...} are the matching buffers, most recent first | 101 ;; The list in {...} are the matching buffers, most recent first |
102 ;; (buffers visible in the current frame are put at the end of the | 102 ;; (buffers visible in the current frame are put at the end of the |
103 ;; list by default). At any time I can select the item at the head of | 103 ;; list by default). At any time I can select the item at the head of |
104 ;; the list by pressing RET. I can also bring the put the first | 104 ;; the list by pressing RET. I can also put the first element at the |
105 ;; element at the end of the list by pressing C-s or [right], or put | 105 ;; end of the list by pressing C-s or [right], or bring the last |
106 ;; the last element at the head of the list by pressing C-r or [left]. | 106 ;; element to the head of the list by pressing C-r or [left]. |
107 ;; | 107 ;; |
108 ;; The item in [...] indicates what can be added to my input by | 108 ;; The item in [...] indicates what can be added to my input by |
109 ;; pressing TAB. In this case, I will get "3" added to my input. | 109 ;; pressing TAB. In this case, I will get "3" added to my input. |
110 | 110 |
111 ;; So, I press TAB: | 111 ;; So, I press TAB: |
208 ;; You can toggle prefix matching with C-p. | 208 ;; You can toggle prefix matching with C-p. |
209 ;; | 209 ;; |
210 ;; Example: | 210 ;; Example: |
211 ;; | 211 ;; |
212 ;; If you have again two Buffers "123456" and "123" then hitting "2" does | 212 ;; If you have again two Buffers "123456" and "123" then hitting "2" does |
213 ;; not match because "2" is not a PREFIX in any of the buffer-names. This | 213 ;; not match because "2" is not a PREFIX in any of the buffer-names. |
214 ;; is the only difference between the substring and prefix matching. | |
215 | 214 |
216 ;; Flexible matching | 215 ;; Flexible matching |
217 ;; ----------------- | 216 ;; ----------------- |
218 ;; | 217 ;; |
219 ;; If you set ido-enable-flex-matching, ido will do a more flexible | 218 ;; If you set ido-enable-flex-matching, ido will do a more flexible |
234 ;; Regexp matching | 233 ;; Regexp matching |
235 ;; --------------- | 234 ;; --------------- |
236 ;; | 235 ;; |
237 ;; There is limited provision for regexp matching within ido, | 236 ;; There is limited provision for regexp matching within ido, |
238 ;; enabled through `ido-enable-regexp' (toggle with C-t). | 237 ;; enabled through `ido-enable-regexp' (toggle with C-t). |
239 ;; This allows you to type `c$' for example and see all file names | 238 ;; This allows you to type `[ch]$' for example and see all file names |
240 ;; ending in `c'. This facility is quite limited though in two | 239 ;; ending in `c' or `h'. |
241 ;; respects. First, you can't currently type in expressions like | 240 ;; |
242 ;; `[0-9]' directly -- you have to type them in when ido-enable-regexp | 241 ;; Note: ido-style completion is inhibited when you enable regexp matching. |
243 ;; is nil and then toggle on the regexp functionality. Likewise, | |
244 ;; don't enter an expression containing `\' in regexp mode. If you | |
245 ;; try, ido gets confused, so just hit C-g and try again. Secondly, | |
246 ;; no completion mechanism is currently offered with regexp searching. | |
247 | 242 |
248 | 243 |
249 ;; Customization | 244 ;; Customization |
250 ;; ------------- | 245 ;; ------------- |
251 ;; | 246 ;; |
1403 (define-key map "\C-p" 'ido-toggle-prefix) | 1398 (define-key map "\C-p" 'ido-toggle-prefix) |
1404 (define-key map "\C-r" 'ido-prev-match) | 1399 (define-key map "\C-r" 'ido-prev-match) |
1405 (define-key map "\C-s" 'ido-next-match) | 1400 (define-key map "\C-s" 'ido-next-match) |
1406 (define-key map "\C-t" 'ido-toggle-regexp) | 1401 (define-key map "\C-t" 'ido-toggle-regexp) |
1407 (define-key map "\C-z" 'ido-undo-merge-work-directory) | 1402 (define-key map "\C-z" 'ido-undo-merge-work-directory) |
1408 (define-key map [(control ? )] 'ido-restrict-to-matches) | 1403 (define-key map [(control ?\s)] 'ido-restrict-to-matches) |
1409 (define-key map [(control ?@)] 'ido-restrict-to-matches) | 1404 (define-key map [(control ?@)] 'ido-restrict-to-matches) |
1410 (define-key map [right] 'ido-next-match) | 1405 (define-key map [right] 'ido-next-match) |
1411 (define-key map [left] 'ido-prev-match) | 1406 (define-key map [left] 'ido-prev-match) |
1412 (define-key map "?" 'ido-completion-help) | 1407 (define-key map "?" 'ido-completion-help) |
1413 | 1408 |
1434 (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir) | 1429 (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir) |
1435 (define-key map [(meta ?k)] 'ido-forget-work-directory) | 1430 (define-key map [(meta ?k)] 'ido-forget-work-directory) |
1436 (define-key map [(meta ?m)] 'ido-make-directory) | 1431 (define-key map [(meta ?m)] 'ido-make-directory) |
1437 (define-key map [(meta ?n)] 'ido-next-work-directory) | 1432 (define-key map [(meta ?n)] 'ido-next-work-directory) |
1438 (define-key map [(meta ?o)] 'ido-prev-work-file) | 1433 (define-key map [(meta ?o)] 'ido-prev-work-file) |
1439 (define-key map [(meta ?O)] 'ido-next-work-file) | 1434 (define-key map [(meta control ?o)] 'ido-next-work-file) |
1440 (define-key map [(meta ?p)] 'ido-prev-work-directory) | 1435 (define-key map [(meta ?p)] 'ido-prev-work-directory) |
1441 (define-key map [(meta ?s)] 'ido-merge-work-directories) | 1436 (define-key map [(meta ?s)] 'ido-merge-work-directories) |
1442 ) | 1437 ) |
1443 | 1438 |
1444 (when (eq ido-cur-item 'file) | 1439 (when (eq ido-cur-item 'file) |
2026 ;; Internal function for ido-find-file and friends | 2021 ;; Internal function for ido-find-file and friends |
2027 (unless item | 2022 (unless item |
2028 (setq item 'file)) | 2023 (setq item 'file)) |
2029 (let ((ido-current-directory (ido-expand-directory default)) | 2024 (let ((ido-current-directory (ido-expand-directory default)) |
2030 (ido-context-switch-command switch-cmd) | 2025 (ido-context-switch-command switch-cmd) |
2031 ido-directory-nonreadable ido-directory-too-big | 2026 ido-directory-nonreadable ido-directory-too-big |
2027 (minibuffer-completing-file-name t) | |
2032 filename) | 2028 filename) |
2033 | 2029 |
2034 (if (or (not ido-mode) (ido-is-slow-ftp-host)) | 2030 (if (or (not ido-mode) (ido-is-slow-ftp-host)) |
2035 (setq filename t | 2031 (setq filename t |
2036 ido-exit 'fallback) | 2032 ido-exit 'fallback) |
2054 (setq ido-exit 'ffap | 2050 (setq ido-exit 'ffap |
2055 filename t)) | 2051 filename t)) |
2056 | 2052 |
2057 ((and ido-use-filename-at-point | 2053 ((and ido-use-filename-at-point |
2058 (setq fn (if (eq ido-use-filename-at-point 'guess) | 2054 (setq fn (if (eq ido-use-filename-at-point 'guess) |
2059 (ffap-guesser) | 2055 (with-no-warnings (ffap-guesser)) |
2060 (ffap-string-at-point))) | 2056 (ffap-string-at-point))) |
2061 (not (string-match "^http:/" fn)) | 2057 (not (string-match "^http:/" fn)) |
2062 (setq d (file-name-directory fn)) | 2058 (setq d (file-name-directory fn)) |
2063 (file-directory-p d)) | 2059 (file-directory-p d)) |
2064 (setq ido-current-directory d) | 2060 (setq ido-current-directory d) |
4213 | 4209 |
4214 ;;; Helper functions for other programs | 4210 ;;; Helper functions for other programs |
4215 | 4211 |
4216 (put 'dired-do-rename 'ido 'ignore) | 4212 (put 'dired-do-rename 'ido 'ignore) |
4217 (put 'ibuffer-find-file 'ido 'find-file) | 4213 (put 'ibuffer-find-file 'ido 'find-file) |
4214 (put 'dired-other-window 'ido 'dir) | |
4218 | 4215 |
4219 ;;;###autoload | 4216 ;;;###autoload |
4220 (defun ido-read-buffer (prompt &optional default require-match) | 4217 (defun ido-read-buffer (prompt &optional default require-match) |
4221 "Ido replacement for the built-in `read-buffer'. | 4218 "Ido replacement for the built-in `read-buffer'. |
4222 Return the name of a buffer selected. | 4219 Return the name of a buffer selected. |
4253 (or (null predicate) (eq predicate 'file-exists-p))) | 4250 (or (null predicate) (eq predicate 'file-exists-p))) |
4254 (let* (ido-saved-vc-hb | 4251 (let* (ido-saved-vc-hb |
4255 (ido-context-switch-command | 4252 (ido-context-switch-command |
4256 (if (eq (get this-command 'ido) 'find-file) nil 'ignore)) | 4253 (if (eq (get this-command 'ido) 'find-file) nil 'ignore)) |
4257 (vc-handled-backends (and (boundp 'vc-handled-backends) vc-handled-backends)) | 4254 (vc-handled-backends (and (boundp 'vc-handled-backends) vc-handled-backends)) |
4255 (minibuffer-completing-file-name t) | |
4258 (ido-current-directory (ido-expand-directory dir)) | 4256 (ido-current-directory (ido-expand-directory dir)) |
4259 (ido-directory-nonreadable (not (file-readable-p ido-current-directory))) | 4257 (ido-directory-nonreadable (not (file-readable-p ido-current-directory))) |
4260 (ido-directory-too-big (and (not ido-directory-nonreadable) | 4258 (ido-directory-too-big (and (not ido-directory-nonreadable) |
4261 (ido-directory-too-big-p ido-current-directory))) | 4259 (ido-directory-too-big-p ido-current-directory))) |
4262 (ido-work-directory-index -1) | 4260 (ido-work-directory-index -1) |
4285 (defun ido-read-directory-name (prompt &optional dir default-dirname mustmatch initial) | 4283 (defun ido-read-directory-name (prompt &optional dir default-dirname mustmatch initial) |
4286 "Ido replacement for the built-in `read-directory-name'. | 4284 "Ido replacement for the built-in `read-directory-name'. |
4287 Read directory name, prompting with PROMPT and completing in directory DIR. | 4285 Read directory name, prompting with PROMPT and completing in directory DIR. |
4288 See `read-directory-name' for additional parameters." | 4286 See `read-directory-name' for additional parameters." |
4289 (let* (filename | 4287 (let* (filename |
4288 (minibuffer-completing-file-name t) | |
4290 (ido-context-switch-command 'ignore) | 4289 (ido-context-switch-command 'ignore) |
4291 ido-saved-vc-hb | 4290 ido-saved-vc-hb |
4292 (ido-current-directory (ido-expand-directory dir)) | 4291 (ido-current-directory (ido-expand-directory dir)) |
4293 (ido-directory-nonreadable (not (file-readable-p ido-current-directory))) | 4292 (ido-directory-nonreadable (not (file-readable-p ido-current-directory))) |
4294 (ido-directory-too-big (and (not ido-directory-nonreadable) | 4293 (ido-directory-too-big (and (not ido-directory-nonreadable) |