]> code.delx.au - gnu-emacs/blobdiff - lisp/ido.el
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
[gnu-emacs] / lisp / ido.el
index 6a66ce0388dd8156d94b16dc6bfed3a50750532c..4cbc88cf0370e0d35592dda62c3e3cdcd83b3d38 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ido.el --- interactively do things with buffers and files.
 
-;; Copyright (C) 1996-2003  Free Software Foundation, Inc.
+;; Copyright (C) 1996-2004  Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Based on: iswitchb by Stephen Eglen <stephen@cns.ed.ac.uk>
@@ -30,8 +30,9 @@
 ;; for ido-switch-buffer and found the inspiration for ido-find-file.
 ;; The ido package would never have existed without his work.
 
-;; Also thanks to Klaus Berndl, Rohit Namjoshi, Robert Fenk, Alex Schroeder,
-;; Bill Benedetto, and Stephen Eglen for bug fixes and improvements.
+;; Also thanks to Klaus Berndl, Rohit Namjoshi, Robert Fenk, Alex
+;; Schroeder, Bill Benedetto, Stephen Eglen, and many others for bug
+;; fixes and improvements.
 
 ;;; History
 
@@ -55,7 +56,7 @@
 ;; so I invented a common "ido-" namespace for the merged packages.
 ;;
 ;; This version is based on ido.el version 1.57 released on
-;; gnu.emacs.sources adapted for emacs 21.4 to use command remapping
+;; gnu.emacs.sources adapted for emacs 21.5 to use command remapping
 ;; and optionally hooking the read-buffer and read-file-name functions.
 ;;
 ;; Prefix matching was added by Klaus Berndl <klaus.berndl@sdm.de> based on
@@ -1667,8 +1668,7 @@ If INITIAL is non-nil, it specifies the initial input string."
        ((memq ido-exit '(edit chdir))
        (cond
         ((memq ido-cur-item '(file dir))
-         (let* ((process-environment (cons "HOME=/" process-environment)) ;; cheat read-file-name
-                (read-file-name-function nil)
+         (let* ((read-file-name-function nil)
                 (edit (eq ido-exit 'edit))
                 (d ido-current-directory)
                 (f ido-text-init)
@@ -1676,7 +1676,9 @@ If INITIAL is non-nil, it specifies the initial input string."
            (setq ido-text-init "")
            (while new
              (setq new (if edit
-                            (read-file-name (concat prompt "[EDIT] ") d (concat d f) nil f)
+                            (read-file-name (concat prompt "[EDIT] ")
+                                            (expand-file-name d)
+                                            (concat d f) nil f)
                           f)
                    d (or (file-name-directory new) "/")
                    f (file-name-nondirectory new)
@@ -3807,15 +3809,19 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
 
 ;;; Helper functions for other programs
 
+(put 'dired-do-rename 'ido 'ignore)
+
 ;;;###autoload
 (defun ido-read-file-name (prompt &optional dir default-filename mustmatch initial predicate)
   "Read file name, prompting with PROMPT and completing in directory DIR.
 See `read-file-name' for additional parameters."
   (cond
   ((or (eq predicate 'file-directory-p)
+       (eq (get this-command 'ido) 'dir)
        (memq this-command ido-read-file-name-as-directory-commands))
    (ido-read-directory-name prompt dir default-filename mustmatch initial))
-  ((and (not (memq this-command ido-read-file-name-non-ido))
+  ((and (not (eq (get this-command 'ido) 'ignore))
+       (not (memq this-command ido-read-file-name-non-ido))
        (or (null predicate) (eq predicate 'file-exists-p)))
    (let* (filename
          ido-saved-vc-hb