• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/

Lines Matching +defs:file +defs:word

10 ;; This file is part of GNU Emacs.
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
42 ;; The buffer or file at the start of the list will be the one visited
44 ;; narrowed down so that gradually the buffer or file you want will be
46 ;; the right and left arrow keys) to rotate buffer or file names in the
98 ;; example, the quickest way to get to the "123456" file would be
102 ;; Likewise, if you use C-x C-f (ido-find-file), the list of files and
113 ;; To go down into a subdirectory, and continue the file selection on
117 ;; To go up to the parent directory, delete any partial file name
127 ;; If for some reason you cannot specify the proper file using
128 ;; ido-find-file, you can press C-f to enter the normal find-file.
131 ;; See the doc string of ido-switch-buffer and ido-find-file for full
133 ;; (describe-function 'ido-find-file)
155 ;; the file at the head of the list with C-k. You will always be
156 ;; asked for confirmation before the file is deleted.
158 ;; If you enter C-x b to switch to a buffer visiting a given file, and
159 ;; you find that the file you are after is not in any buffer, you can
160 ;; press C-f to immediately drop into ido-find-file. And you can
185 ;; among the available buffer or file names if no matches are found using
203 ;; This allows you to type `[ch]$' for example and see all file names
267 ;; Replacement for read-buffer and read-file-name
270 ;; ido-read-buffer and ido-read-file-name have been written to be drop
271 ;; in replacements for the normal buffer and file name reading
272 ;; functions `read-buffer' and `read-file-name'.
274 ;; To use ido for all buffer and file selections in Emacs, customize the
281 ;; ido-read-buffer, ido-read-file-name, and ido-read-directory-name
282 ;; can be used by other packages to read a buffer name, a file name,
289 ;; for ido-switch-buffer and found the inspiration for ido-find-file.
319 ;; and optionally hooking the read-buffer and read-file-name functions.
352 - `file': Turn only on ido file behavior \(finding, writing, inserting...)
353 - `both': Turn on ido buffer and file behavior.
363 :set-after '(ido-save-directory-list-file
365 ;; before loading history file.
368 (const :tag "Turn on only file" file)
369 (const :tag "Turn on both buffer and file" both)
374 "Use ido everywhere for reading file names and directories.
384 "*Non-nil if searching of buffer and file names should ignore case."
392 with a space, for which the regexp is `\\` '. See the source file for
399 "*List of regexps or functions matching file names to ignore.
401 with a #, for which the regexp is `\\`#'. See the source file for
412 "*Non-nil means to always put . as the first item in file name lists.
417 (defcustom ido-file-extensions-order nil
418 "*List of file extensions specifying preferred order of file selections.
421 for files with an unlisted file extension."
435 in merged file and directory lists."
451 (defcustom ido-default-file-method 'raise-frame
452 "*How to visit a new file when using `ido-find-file'.
454 `selected-window' Show new file in selected window
455 `other-window' Show new file in another window (same frame)
456 `display' Display file in another window without selecting to it
457 `other-frame' Show new file in another frame
458 `maybe-frame' If a file is visible in another frame, prompt to ask if you
459 you want to see the file in the same window of the current
461 `raise-frame' If a file is visible in another frame, raise that
462 frame; otherwise, visit the file in the same window"
473 See `ido-default-file-method' for details."
504 "*Non-nil means only match if the entered text is a prefix of file name.
547 (defcustom ido-max-file-prompt-width 0.35
570 See `ido-last-directory-list' and `ido-save-directory-list-file'."
577 See `ido-work-directory-list' and `ido-save-directory-list-file'."
602 If found, call `find-file-at-point' to visit it."
609 A tramp file name uses the following syntax: /method:user@host:filename."
614 "*Non-nil means record ftp file names in the work directory list."
619 "*If nil means merging ignores ftp file names in the work directory list."
633 equivalent function, e.g. `find-file' rather than `ido-find-file'."
676 (defcustom ido-max-work-file-list 10
678 This is the list the file names (sans directory) which have most recently
679 been opened. See `ido-work-file-list' and `ido-save-directory-list-file'."
685 When some text is already entered at the `ido-find-file' prompt, using
692 "*Automatically switch to merged work directories during file name input.
706 When a (partial) file name matches this regexp, merging is inhibited."
715 (defcustom ido-max-dir-file-cache 100
717 This is the size of the cache of `file-name-all-completions' results.
723 See also `ido-dir-file-cache' and `ido-save-directory-list-file'."
735 (defcustom ido-rotate-file-list-default nil
736 "*Non-nil means that `ido' will always rotate file list to get default in front."
765 is read by ido, possible values are file, dir, buffer, and list.
833 (defcustom ido-make-file-list-hook nil
854 (defcustom ido-rewrite-file-prompt-functions nil
855 "*List of functions to run when the find-file prompt is created.
868 item - equals `file' or `dir' depending on the current mode."
872 (defvar ido-rewrite-file-prompt-rules nil
880 `ido-rewrite-file-prompt-functions'.")
916 (defcustom ido-save-directory-list-file "~/.ido.last"
919 `ido-work-file-list', and `ido-dir-file-cache'.
924 (defcustom ido-read-file-name-as-directory-commands '()
925 "List of commands which uses `read-file-name' to read a directory name.
931 (defcustom ido-read-file-name-non-ido '()
932 "List of commands which shall not read file names the ido way.
934 the file name using normal `read-file-name' style."
954 (defvar ido-file-completion-map nil
955 "Keymap for ido file commands.")
957 (defvar ido-file-dir-completion-map nil
958 "Keymap for ido file and directory commands.")
963 (defvar ido-file-history nil
964 "History of files selected using `ido-find-file'.")
976 file is opened with `ido-find-file' and family.")
978 (defvar ido-work-file-list nil
979 "List of actual work file names.
980 Opening a file with `ido-find-file' and similar functions
981 inserts the current file name (relative to its containing directory)
984 (defvar ido-dir-file-cache nil
985 "List of `file-name-all-completions' results.
1025 "Flag to monitor how `ido-find-file' exits.
1026 If equal to `takeprompt', we use the prompt as the file name to be
1030 "Current directory for `ido-find-file'.")
1050 ;; Stores the current ido item type ('file, 'dir, 'buffer, or 'list).
1087 ;; Non-nil if matching file must be selected.
1090 ;; Stores a temporary version of the file list being created.
1099 ;; Stores current index in ido-work-file-list.
1100 (defvar ido-work-file-index)
1115 ;; Stores temporary state of literal find file.
1118 ;; Set to 'ignore to inhibit switching between find-file/switch-buffer.
1154 (defun ido-local-file-exists-p (file)
1156 (let (file-name-handler-alist)
1157 (file-exists-p file)))
1234 "\\`/[^/:][^/:]+:" ;; like tramp-file-name-regexp-unified, but doesn't match single drive letters
1306 (when (and ido-last-directory-list ido-save-directory-list-file)
1314 (ido-pp 'ido-work-file-list)
1315 (ido-pp 'ido-dir-file-cache "\n\n ")
1320 (write-file ido-save-directory-list-file nil))
1327 (if (or arg (and ido-save-directory-list-file (not ido-last-directory-list)))
1328 (let ((file (expand-file-name ido-save-directory-list-file))
1330 (when (file-readable-p file)
1335 (insert-file-contents file)
1339 ido-work-file-list (read (current-buffer))
1340 ido-dir-file-cache (read (current-buffer))
1371 (setq ido-work-file-list
1372 (and (listp ido-work-file-list)
1373 (let ((l ido-work-file-list) r)
1379 (setq ido-dir-file-cache
1380 (and (listp ido-dir-file-cache)
1381 (let ((l ido-dir-file-cache) r)
1434 (let ((l ido-work-file-list) e)
1438 (let ((l ido-dir-file-cache) e d)
1459 keybindings for the `find-file' and `switch-to-buffer' families of
1469 ((eq arg 'files) 'file)
1471 ((memq arg '(file buffer both)) arg)
1487 (when (memq ido-mode '(file both))
1488 (define-key map [remap find-file] 'ido-find-file)
1489 (define-key map [remap find-file-read-only] 'ido-find-file-read-only)
1490 (define-key map [remap find-alternate-file] 'ido-find-alternate-file)
1491 (define-key map [remap write-file] 'ido-write-file)
1492 (define-key map [remap insert-file] 'ido-insert-file)
1495 (define-key map [remap find-file-other-window] 'ido-find-file-other-window)
1496 (define-key map [remap find-file-read-only-other-window] 'ido-find-file-read-only-other-window)
1497 (define-key map [remap find-file-other-frame] 'ido-find-file-other-frame)
1498 (define-key map [remap find-file-read-only-other-frame] 'ido-find-file-read-only-other-frame))
1515 "Toggle using ido speed-ups everywhere file and directory names are read.
1521 (when (get 'ido-everywhere 'file)
1522 (setq read-file-name-function (car (get 'ido-everywhere 'file)))
1523 (put 'ido-everywhere 'file nil))
1528 (when (memq ido-mode '(both file))
1529 (put 'ido-everywhere 'file (cons read-file-name-function nil))
1530 (setq read-file-name-function 'ido-read-file-name))
1579 (define-key map [remap backward-kill-word] 'ido-delete-backward-word-updir) ; M-DEL
1586 (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir)
1590 (define-key map [(meta ?o)] 'ido-prev-work-file)
1591 (define-key map [(meta control ?o)] 'ido-next-work-file)
1595 (setq ido-file-dir-completion-map map))
1599 (define-key map "\C-k" 'ido-delete-file-at-head)
1600 (define-key map "\C-o" 'ido-copy-current-word)
1601 (define-key map "\C-w" 'ido-copy-current-file-name)
1604 (set-keymap-parent map ido-file-dir-completion-map)
1605 (setq ido-file-completion-map map))
1609 (define-key map "\C-x\C-f" 'ido-enter-find-file)
1627 ((memq ido-cur-item '(file dir))
1634 (define-key map [remap viper-delete-backward-word] 'ido-delete-backward-word-updir))
1636 (if (eq ido-cur-item 'file)
1637 ido-file-completion-map
1638 ido-file-dir-completion-map)))
1675 (file-directory-p dir)
1676 (not (file-readable-p dir)))))
1686 (file-directory-p dir)
1687 (> (nth 7 (file-attributes dir)) ido-max-directory-size))))
1724 (ido-set-current-directory (expand-file-name (or dir "~/"))))
1737 ((and (memq item '(file dir)) ido-current-directory)
1738 (let ((dirname (abbreviate-file-name ido-current-directory))
1739 (max-width (if (and ido-max-file-prompt-width (floatp ido-max-file-prompt-width))
1740 (floor (* (frame-width) ido-max-file-prompt-width))
1741 ido-max-file-prompt-width))
1745 (rule ido-rewrite-file-prompt-rules))
1755 (run-hooks 'ido-rewrite-file-prompt-functions)
1769 ;; Here is very briefly how ido-find-file works:
1771 ;; (ido-find-file)
1772 ;; (ido-file-internal method)
1774 ;; (ido-read-internal 'file ...)
1795 ;; exit with the return value of ido-selected (file name)
1796 ;; selected file name is returned from ido-read-internal,
1798 ;; e.g. the file name may be ignored or joined with ido-current-directory, and
1799 ;; the relevant function is called (find-file, write-file, etc).
1802 "Perform the `ido-read-buffer' and `ido-read-file-name' functions.
1803 Return the name of a buffer or file selected.
1806 If REQUIRE-MATCH is non-nil, an existing file must be selected.
1850 (if (memq item '(file dir))
1851 (file-name-nondirectory default)
1853 ((eq item 'file)
1871 (l (ido-make-merged-file-list ido-text-init
1916 ((eq ido-cur-item 'file)
1920 (ido-make-file-list ido-default-item))))
1944 (if (memq ido-cur-item '(file dir))
1948 (if (memq ido-cur-item '(file dir))
1957 ;; prompt the user for the file name
1987 ((memq ido-cur-item '(file dir))
1988 (let* ((read-file-name-function nil)
1997 (read-file-name (concat prompt "[EDIT] ")
1998 (expand-file-name d)
2002 d (or (file-name-directory new) "/")
2003 f (file-name-nondirectory new)
2006 (file-directory-p d)
2029 ((memq ido-exit '(dired fallback find-file switch-to-buffer insert-buffer insert-file))
2044 (setq ido-text-init (file-name-nondirectory (substring ido-current-directory 0 -1)))
2046 (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))
2069 (file-exists-p (concat ido-current-directory ido-final-text))
2092 (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1))))
2097 (not (ido-local-file-exists-p ido-selected)))
2108 (ido-set-current-directory (file-name-directory ido-selected))
2126 (file-exists-p (concat ido-current-directory (cdr elt))))
2138 "Edit absolute file name entered so far with ido; terminate by RET.
2165 ((eq ido-exit 'find-file)
2166 (ido-file-internal ido-default-file-method nil nil nil nil ido-text))
2168 ((eq ido-exit 'insert-file)
2169 (ido-file-internal 'insert 'insert-file nil "Insert file: " nil ido-text 'ido-enter-insert-buffer))
2236 (defun ido-record-work-file (name)
2237 ;; Save NAME in ido-work-file-list
2238 (when (and (numberp ido-max-work-file-list) (> ido-max-work-file-list 0))
2240 (and ido-work-file-list (equal (car ido-work-file-list) name))
2241 (setq ido-work-file-list (cons name (delete name ido-work-file-list))))
2242 (if (> (length ido-work-file-list) ido-max-work-file-list)
2243 (setcdr (nthcdr (1- ido-max-work-file-list) ido-work-file-list) nil))))
2248 (ido-final-slash (expand-file-name (or dir default-directory)) t))
2250 (defun ido-file-internal (method &optional fallback default prompt item initial switch-cmd)
2251 ;; Internal function for ido-find-file and friends
2253 (setq item 'file))
2268 (when (and (eq item 'file)
2287 (setq d (file-name-directory fn))
2288 (file-directory-p d))
2290 (setq initial (file-name-nondirectory fn))))))
2295 (ido-work-file-index -1)
2300 (let ((minibuffer-completing-file-name t))
2302 (or prompt "Find file: ")
2303 'ido-file-history
2304 (and (eq method 'alt-file) buffer-file-name)
2307 ;; Choose the file name: either the text typed in, or the head
2315 (read-file-name-function nil))
2316 (setq this-command (or fallback 'find-file))
2324 (ido-buffer-internal 'insert 'insert-buffer "Insert buffer: " nil ido-text 'ido-enter-insert-file))
2330 (find-file-at-point))
2332 ((eq method 'alt-file)
2333 (ido-record-work-file filename)
2336 (find-alternate-file filename))
2342 (file (substring dirname 0 -1)))
2344 ((file-directory-p dirname)
2348 ((file-directory-p ido-current-directory)
2350 ((file-exists-p file)
2356 (dired-goto-file (expand-file-name file)))))
2373 (ido-record-work-file filename)
2376 (ido-record-command 'write-file filename)
2377 (add-to-history 'file-name-history filename)
2379 (write-file filename))
2382 (ido-record-work-file filename)
2390 (ido-record-work-file filename)
2393 (if ido-find-literal 'insert-file-literally 'insert-file)
2395 (add-to-history 'file-name-history filename)
2397 (insert-file-1 filename
2399 #'insert-file-contents-literally
2400 #'insert-file-contents)))
2403 (ido-record-work-file filename)
2405 (ido-record-command 'find-file filename)
2406 (add-to-history 'file-name-history filename)
2408 (ido-visit-buffer (find-file-noselect filename nil ido-find-literal) method))))))
2430 "Try and complete the current pattern amongst the file names."
2437 ((and (memq ido-cur-item '(file dir))
2439 (let ((evar (substitute-in-file-name (concat ido-current-directory ido-text))))
2440 (if (not (file-exists-p (file-name-directory evar)))
2442 (if (file-directory-p evar)
2444 (let ((d (or (file-name-directory evar) "/"))
2445 (f (file-name-nondirectory evar)))
2446 (when (file-directory-p d)
2466 (not (ido-local-file-exists-p (ido-name (car ido-matches)))))
2541 C-x C-b ... C-f switch to ido-find-file.
2542 C-x C-f ... C-f fallback to non-ido find-file.
2549 ((memq ido-cur-item '(file dir))
2554 (ido-enter-find-file))))
2570 (when (and (memq ido-cur-item '(file dir))
2592 ((memq ido-cur-item '(file dir))
2634 "Disable version control for this file."
2636 (if (and ido-mode (eq ido-cur-item 'file))
2645 "Toggle literal reading of this file."
2647 (if (and ido-mode (eq ido-cur-item 'file))
2659 (if (and ido-mode (memq ido-cur-item '(file dir)))
2678 "Select the buffer or file named by the prompt.
2679 If no buffer or file exactly matching the prompt exists, maybe create a new one."
2693 (defun ido-enter-find-file ()
2694 "Drop into `find-file' from buffer switching."
2696 (setq ido-exit 'find-file)
2700 "Drop into `ido-switch-buffer' from file switching."
2706 "Drop into `dired' from file switching."
2712 "Drop into `insert-buffer' from insert file."
2717 (defun ido-enter-insert-file ()
2718 "Drop into `insert-file' from insert buffer."
2720 (setq ido-exit 'insert-file)
2748 (defun ido-delete-backward-word-updir (count)
2754 (if (eq this-original-command 'viper-delete-backward-word)
2756 (backward-kill-word (prefix-numeric-value count)))))
2774 (file-directory-p dir)
2778 (if (eq ido-cur-item 'file)
2779 (ido-make-file-list-1 dir)
2818 (defun ido-wide-find-file (&optional file)
2821 (unless file
2823 (setq file
2825 (read-string (concat "Wide find file: " ido-current-directory) ido-text)
2827 (when (> (length file) 0)
2830 (setq ido-text-init file)
2855 (ido-delete-backward-word-updir 1)
2867 "Move to previous directory in file name, push current input on stack."
2873 "Move to previous directory in file name, push first match on stack."
2888 (defun ido-wide-find-file-or-pop-dir (arg)
2892 (ido-wide-find-file)))
2903 (unless (file-exists-p dir)
2911 (defun ido-get-work-file (incr)
2912 (let ((n (length ido-work-file-list))
2913 (i (+ ido-work-file-index incr))
2918 (setq name (nth i ido-work-file-list))
2919 (setq ido-work-file-index i)
2922 (defun ido-prev-work-file ()
2923 "Change to next working file name in list."
2925 (let ((name (ido-get-work-file 1)))
2931 (defun ido-next-work-file ()
2932 "Change to previous working file name in list."
2934 (let ((name (ido-get-work-file -1)))
2940 (defun ido-copy-current-file-name (all)
2941 "Insert file name of current buffer.
2944 (let* ((bfname (or (buffer-file-name ido-entry-buffer)
2946 (name (and bfname (file-name-nondirectory bfname))))
2951 (not (equal (file-name-directory bfname) ido-current-directory))
2959 (defun ido-copy-current-word (all)
2960 "Insert current word (file or directory name) from current buffer."
2962 (let ((word (save-excursion
2981 ((not word) nil)
2982 ((string-match "\\`[~/]" word)
2983 (setq ido-text-init word
2986 ((string-match "/" word)
2987 (setq ido-text-init (concat ido-current-directory word)
2991 (setq ido-text-init word
3017 first matching file."
3036 for first matching file."
3078 ;; Return file name for current item, whether in a normal list
3090 ((eq ido-cur-item 'file)
3091 (ido-make-file-list-1 ido-current-directory))
3103 (defun ido-file-lessp (a b)
3104 ;; Simple compare two file names.
3108 (defun ido-file-extension-lessp (a b)
3109 ;; Compare file names according to ido-file-extensions-order list.
3123 (ido-file-extension-aux a b n lessp))
3128 (ido-file-extension-aux a b n lessp)
3131 (defun ido-file-extension-aux (a b n lessp)
3132 (let ((oa (ido-file-extension-order a n))
3133 (ob (ido-file-extension-order b n)))
3150 (defun ido-file-extension-order (s n)
3151 (let ((l ido-file-extensions-order)
3168 ;; Input is list of ("file" . "dir") cons cells.
3169 ;; Output is sorted list of ("file "dir" ...) lists
3184 (defun ido-wide-find-dirs-or-files (dir file &optional prefix finddir)
3185 ;; As ido-run-find-command, but returns a list of cons pairs ("file" . "dir")
3193 (concat (if prefix "" "*") file "*"))
3201 (file-exists-p filename))
3202 (setq d (file-name-directory filename)
3203 f (file-name-nondirectory filename)
3212 (file (car item))
3215 (setq res (cons (concat (car dirs) file) res)
3221 (defun ido-make-merged-file-list-1 (text auto wide)
3223 (if (and (ido-final-slash text) ido-dir-file-cache)
3229 (dirs ido-dir-file-cache)
3237 (file-directory-p dir))
3239 f (concat (file-name-nondirectory b) "/")
3240 d (file-name-directory b)
3272 (file-directory-p dir)
3274 (setq fl (if (eq ido-cur-item 'file)
3275 (ido-make-file-list-1 dir t)
3286 (defun ido-make-merged-file-list (text auto wide)
3292 (ido-make-merged-file-list-1 text auto wide))))
3300 (when (and (or ido-rotate-temp ido-rotate-file-list-default)
3365 (defun ido-file-name-all-completions-1 (dir)
3379 (or (file-name-all-completions "" dir)
3385 (tramp-tramp-file-p dir)
3386 (fboundp 'tramp-ftp-file-name-p)
3387 (funcall 'tramp-ftp-file-name-p dir)
3389 (file-name-all-completions "" (concat dir "./"))))))
3396 (file-name-all-completions "" dir))))
3398 (defun ido-file-name-all-completions (dir)
3400 ;; Uses and updates ido-dir-file-cache
3407 ((and (numberp ido-max-dir-file-cache) (> ido-max-dir-file-cache 0)
3410 (let* ((cached (assoc dir ido-dir-file-cache))
3414 (attr (if (or ftp unc) nil (file-attributes dir)))
3430 (setq ido-dir-file-cache (delq cached ido-dir-file-cache)
3436 ((and ftp (file-readable-p dir))
3439 (setq cached (cons dir (cons mtime (ido-file-name-all-completions-1 dir)))
3440 ido-dir-file-cache (cons cached ido-dir-file-cache)))
3441 (if (> (length ido-dir-file-cache) ido-max-dir-file-cache)
3442 (setcdr (nthcdr (1- ido-max-dir-file-cache) ido-dir-file-cache) nil)))
3446 (ido-file-name-all-completions-1 dir))))
3449 ;; Remove dir from ido-dir-file-cache
3450 (if (and ido-dir-file-cache
3452 (let ((cached (assoc dir ido-dir-file-cache)))
3454 (setq ido-dir-file-cache (delq cached ido-dir-file-cache))))))
3457 (defun ido-make-file-list-1 (dir &optional merged)
3459 ;; If MERGED is non-nil, each file is cons'ed with DIR
3461 (file-directory-p dir))
3467 (ido-file-name-all-completions dir)))))
3469 (defun ido-make-file-list (default)
3472 ;; The hook `ido-make-file-list-hook' is run after the list has been
3473 ;; created to allow the user to further modify the order of the file names
3475 (let ((ido-temp-list (ido-make-file-list-1 ido-current-directory)))
3477 (if ido-file-extensions-order
3478 #'ido-file-extension-lessp
3479 #'ido-file-lessp)))
3485 (not (ido-local-file-exists-p x)))
3487 (let (file-name-handler-alist)
3488 (get-file-buffer x)))) x))
3495 (if (or ido-rotate-temp ido-rotate-file-list-default)
3511 (run-hooks 'ido-make-file-list-hook)
3517 (and (or (ido-is-tramp-root dir) (file-directory-p dir))
3523 (ido-file-name-all-completions dir)))))
3531 (setq ido-temp-list (sort ido-temp-list #'ido-file-lessp))
3537 (if (or ido-rotate-temp ido-rotate-file-list-default)
3667 ;; Return t if the buffer or file NAME should be ignored.
3703 ;; Private variable used by `ido-word-matching-substring'.
3704 (defvar ido-change-word-sub)
3710 ido-change-word-sub)
3711 (setq ido-change-word-sub
3715 (setq res (mapcar #'ido-word-matching-substring items))
3726 (defun ido-word-matching-substring (word)
3727 ;; Return part of WORD before 1st match to `ido-change-word-sub'.
3728 ;; If `ido-change-word-sub' cannot be found in WORD, return nil.
3730 (let ((m (string-match ido-change-word-sub (ido-name word))))
3732 (substring (ido-name word) m)
3800 #'ido-file-lessp)))
3833 (defun ido-delete-file-at-head ()
3834 "Delete the file at the head of `ido-matches'.
3840 (file (ido-name (car ido-matches))))
3841 (if file
3842 (setq file (concat ido-current-directory file)))
3843 (when (and file
3844 (file-exists-p file)
3845 (not (file-directory-p file))
3846 (file-writable-p ido-current-directory)
3847 (yes-or-no-p (concat "Delete " file "? ")))
3848 (delete-file file)
3849 ;; Check if file still exists.
3850 (if (file-exists-p file)
3851 ;; file could not be deleted
3853 ;; else file was killed so remove name from list.
3945 \\[ido-enter-find-file] Drop into `ido-find-file'.
3981 (ido-buffer-internal 'insert 'insert-buffer "Insert buffer: " nil nil 'ido-enter-insert-file))
3994 (defun ido-find-file-in-dir (dir)
3995 "Switch to another file starting from DIR."
3999 (ido-file-internal ido-default-file-method nil dir nil nil nil 'ignore))
4002 (defun ido-find-file ()
4003 "Edit file with name obtained via minibuffer.
4004 The file is displayed according to `ido-default-file-method' -- the
4008 The file name is selected interactively by typing a substring. As you
4013 except for the following: \\<ido-file-completion-map>
4015 RET Select the file at the front of the list of matches. If the
4016 list is empty, possibly prompt to create new file.
4018 \\[ido-select-text] Select the current prompt as the buffer or file.
4019 If no buffer or file is found, prompt for a new one.
4024 matches all files. If there is only one match, select that file.
4029 \\[ido-merge-work-directories] search for file in the work directory history.
4031 \\[ido-prev-work-file] or \\[ido-next-work-file] cycle through the work file history.
4032 \\[ido-wide-find-file-or-pop-dir] and \\[ido-wide-find-dir-or-delete-dir] prompts and uses find to locate files or directories.
4037 \\[ido-toggle-case] Toggle case-sensitive searching of file names.
4038 \\[ido-toggle-vc] Toggle version control for this file.
4039 \\[ido-toggle-literal] Toggle literal reading of this file.
4044 (ido-file-internal ido-default-file-method))
4047 (defun ido-find-file-other-window ()
4048 "Switch to another file and show it in another window.
4049 The file name is selected interactively by typing a substring.
4050 For details of keybindings, see `ido-find-file'."
4052 (ido-file-internal 'other-window 'find-file-other-window))
4055 (defun ido-find-alternate-file ()
4056 "Switch to another file and show it in another window.
4057 The file name is selected interactively by typing a substring.
4058 For details of keybindings, see `ido-find-file'."
4060 (ido-file-internal 'alt-file 'find-alternate-file nil "Find alternate file: "))
4063 (defun ido-find-file-read-only ()
4064 "Edit file read-only with name obtained via minibuffer.
4065 The file name is selected interactively by typing a substring.
4066 For details of keybindings, see `ido-find-file'."
4068 (ido-file-internal 'read-only 'find-file-read-only nil "Find file read-only: "))
4071 (defun ido-find-file-read-only-other-window ()
4072 "Edit file read-only in other window with name obtained via minibuffer.
4073 The file name is selected interactively by typing a substring.
4074 For details of keybindings, see `ido-find-file'."
4076 (ido-file-internal 'read-only 'find-file-read-only-other-window nil "Find file read-only other window: "))
4079 (defun ido-find-file-read-only-other-frame ()
4080 "Edit file read-only in other frame with name obtained via minibuffer.
4081 The file name is selected interactively by typing a substring.
4082 For details of keybindings, see `ido-find-file'."
4084 (ido-file-internal 'read-only 'find-file-read-only-other-frame nil "Find file read-only other frame: "))
4087 (defun ido-display-file ()
4088 "Display a file in another window but don't select it.
4089 The file name is selected interactively by typing a substring.
4090 For details of keybindings, see `ido-find-file'."
4092 (ido-file-internal 'display nil nil nil nil nil 'ignore))
4095 (defun ido-find-file-other-frame ()
4096 "Switch to another file and show it in another frame.
4097 The file name is selected interactively by typing a substring.
4098 For details of keybindings, see `ido-find-file'."
4100 (ido-file-internal 'other-frame 'find-file-other-frame))
4103 (defun ido-write-file ()
4104 "Write current buffer to a file.
4105 The file name is selected interactively by typing a substring.
4106 For details of keybindings, see `ido-find-file'."
4114 (ido-file-internal 'write 'write-file nil "Write file: " nil nil 'ignore)))
4117 (defun ido-insert-file ()
4118 "Insert contents of file in current buffer.
4119 The file name is selected interactively by typing a substring.
4120 For details of keybindings, see `ido-find-file'."
4122 (ido-file-internal 'insert 'insert-file nil "Insert file: " nil nil 'ido-enter-insert-buffer))
4128 For details of keybindings, see `ido-find-file'."
4132 (ido-file-internal 'dired 'dired nil "Dired: " 'dir)))
4137 For details of keybindings, see `ido-find-file'."
4141 (ido-file-internal 'list-directory 'list-directory nil "List directory: " 'dir)))
4177 ;; 1. It prints a default file name when there is no text yet entered.
4224 (not (ido-local-file-exists-p contents)))
4248 (expand-file-name
4249 (substitute-in-file-name (substring contents 0 -1))
4253 (when (and exp (file-directory-p exp))
4254 (ido-set-current-directory (file-name-directory exp))
4255 (setq ido-text-init (file-name-nondirectory exp))
4259 (ido-set-current-directory (file-name-directory contents))
4264 (expand-file-name "/" ido-current-directory)
4268 (file-directory-p (concat ido-current-directory (file-name-directory contents))))
4270 (concat ido-current-directory (file-name-directory contents)))
4350 (memq ido-cur-item '(file dir))
4439 ;; when there is one match, show the matching file name in full
4536 (put 'ibuffer-find-file 'ido 'find-file)
4558 (defun ido-read-file-name (prompt &optional dir default-filename mustmatch initial predicate)
4559 "Ido replacement for the built-in `read-file-name'.
4560 Read file name, prompting with PROMPT and completing in directory DIR.
4561 See `read-file-name' for additional parameters."
4564 ((or (eq predicate 'file-directory-p)
4566 (memq this-command ido-read-file-name-as-directory-commands))
4572 (not (memq this-command ido-read-file-name-non-ido))
4573 (or (null predicate) (eq predicate 'file-exists-p)))
4576 (if (eq (get this-command 'ido) 'find-file) nil 'ignore))
4578 (minibuffer-completing-file-name t)
4580 (ido-directory-nonreadable (not (file-readable-p ido-current-directory)))
4586 (ido-work-file-index -1)
4590 (ido-read-internal 'file prompt 'ido-file-history default-filename mustmatch initial))
4602 (let ((read-file-name-function nil))
4603 (run-hook-with-args 'ido-before-fallback-functions 'read-file-name)
4604 (read-file-name prompt dir default-filename mustmatch initial predicate))
4613 (minibuffer-completing-file-name t)
4617 (ido-directory-nonreadable (not (file-readable-p ido-current-directory)))
4621 (ido-work-file-index -1))
4623 (ido-read-internal 'dir prompt 'ido-file-history default-dirname mustmatch initial))