]> code.delx.au - gnu-emacs/blobdiff - lisp/ido.el
(mode-require-final-newline): Revert accidental change.
[gnu-emacs] / lisp / ido.el
index 996eb2c47bc49a5eb40cc505932aee804eaf7fc4..4409c3653c9994149f2e09de6a16f8d5e3425cb1 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ido.el --- interactively do things with buffers and files.
 
-;; Copyright (C) 1996-2004  Free Software Foundation, Inc.
+;; Copyright (C) 1996-2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Based on: iswitchb by Stephen Eglen <stephen@cns.ed.ac.uk>
   "Switch between files using substrings."
   :group 'extensions
   :group 'convenience
-  :version "21.4"
+  :version "22.1"
   :link '(emacs-commentary-link :tag "Commentary" "ido.el")
   :link '(emacs-library-link :tag "Lisp File" "ido.el"))
 
@@ -747,13 +747,19 @@ subdirs in the alternatives."
   "*Font used by ido for highlighting only match."
   :group 'ido)
 
-(defface ido-subdir-face  '((((class color))
+(defface ido-subdir-face  '((((min-colors 88) (class color))
+                             (:foreground "red1"))
+                           (((class color))
                              (:foreground "red"))
                             (t (:underline t)))
   "*Font used by ido for highlighting subdirs in the alternatives."
   :group 'ido)
 
-(defface ido-indicator-face  '((((class color))
+(defface ido-indicator-face  '((((min-colors 88) (class color))
+                               (:foreground "yellow1"
+                                :background "red1"
+                                :width condensed))
+                              (((class color))
                                (:foreground "yellow"
                                 :background "red"
                                 :width condensed))
@@ -1787,7 +1793,7 @@ If INITIAL is non-nil, it specifies the initial input string."
                (ido-name (car ido-matches))))
 
        (cond
-        ((eq item 'buffer)
+        ((memq item '(buffer list))
          (setq done t))
 
         ((string-equal "./" ido-selected)
@@ -1935,19 +1941,21 @@ If INITIAL is non-nil, it specifies the initial input string."
   ;; Internal function for ido-find-file and friends
   (unless item
     (setq item 'file))
-  (let* ((ido-current-directory (ido-expand-directory default))
-        (ido-directory-nonreadable (ido-nonreadable-directory-p ido-current-directory))
-        (ido-directory-too-big (and (not ido-directory-nonreadable)
-                                    (ido-directory-too-big-p ido-current-directory)))
-        (ido-context-switch-command switch-cmd)
-        filename)
-
-    (cond
-     ((or (not ido-mode) (ido-is-slow-ftp-host))
-      (setq filename t
-           ido-exit 'fallback))
-
-     ((and (eq item 'file)
+  (let ((ido-current-directory (ido-expand-directory default))
+       (ido-context-switch-command switch-cmd)
+        ido-directory-nonreadable ido-directory-too-big
+       filename)
+
+    (if (or (not ido-mode) (ido-is-slow-ftp-host))
+       (setq filename t
+             ido-exit 'fallback)
+      (setq ido-directory-nonreadable
+           (ido-nonreadable-directory-p ido-current-directory)
+           ido-directory-too-big
+           (and (not ido-directory-nonreadable)
+                (ido-directory-too-big-p ido-current-directory))))
+
+    (when (and (eq item 'file)
           (or ido-use-url-at-point ido-use-filename-at-point))
       (let (fn d)
        (require 'ffap)
@@ -1966,7 +1974,7 @@ If INITIAL is non-nil, it specifies the initial input string."
               (setq d (file-name-directory fn))
               (file-directory-p d))
          (setq ido-current-directory d)
-         (setq initial (file-name-nondirectory fn)))))))
+         (setq initial (file-name-nondirectory fn))))))
 
     (let (ido-saved-vc-hb
          (vc-handled-backends (and (boundp 'vc-handled-backends) vc-handled-backends))
@@ -2280,6 +2288,9 @@ If no buffer or file exactly matching the prompt exists, maybe create a new one.
 (defun ido-fallback-command ()
   "Fallback to non-ido version of current command."
   (interactive)
+  (let ((i (length ido-text)))
+    (while (> i 0)
+      (push (aref ido-text (setq i (1- i))) unread-command-events)))
   (setq ido-exit 'fallback)
   (exit-minibuffer))