]> code.delx.au - gnu-emacs/blobdiff - lisp/ido.el
*** empty log message ***
[gnu-emacs] / lisp / ido.el
index f9ba8178cba572b298e0b0b929b6ade4f3eccce1..56cf8be3ece9c60b710118e1d18957c409d527ec 100644 (file)
@@ -489,6 +489,15 @@ Value can be toggled within `ido' using `ido-toggle-prefix'."
   :type 'boolean
   :group 'ido)
 
+(defcustom ido-cannot-complete-command 'ido-completion-help
+  "*Command run when `ido-complete' can't complete any more.
+The most useful values are `ido-completion-help', which pops up a
+window with completion alternatives, or `ido-next-match' or
+`ido-prev-match', which cycle the buffer list."
+  :type 'function
+  :group 'ido)
+
+
 (defcustom ido-record-commands t
   "*Non-nil means that `ido' will record commands in command history.
 Note that the non-ido equivalent command is recorded."
@@ -814,9 +823,6 @@ the file name using normal read-file-name style."
 (defvar  ido-buffer-history nil
   "History of buffers selected using `ido-switch-buffer'.")
 
-(defvar ido-xemacs  (string-match "XEmacs" (emacs-version))
-  "Non-nil if we are running XEmacs.  Otherwise, assume we are running Emacs.")
-
 (defvar ido-last-directory-list nil
   "List of last selected directory paths.
 See `ido-enable-last-directory-history' for details.")
@@ -1928,8 +1934,7 @@ If INITIAL is non-nil, it specifies the initial input string."
 
      ((not ido-matches)
       (when ido-completion-buffer
-       (setq this-command 'ido-completion-help)
-       (ido-completion-help)))
+       (call-interactively (setq this-command ido-cannot-complete-command))))
          
      ((= 1 (length ido-matches))
       ;; only one choice, so select it.
@@ -1946,7 +1951,7 @@ If INITIAL is non-nil, it specifies the initial input string."
            (delete-region (minibuffer-prompt-end) (point))
            (insert res))
        ;; else nothing to complete
-       (ido-completion-help)
+       (call-interactively (setq this-command ido-cannot-complete-command))
        )))))
 
 (defun ido-complete-space ()
@@ -2440,7 +2445,6 @@ for first matching file."
        res)
     (while paths
       (setq path (car paths)
-           paths (cdr paths)
            paths (cdr paths))
       (if (and (string-match "^/" path)
               (file-exists-p path))
@@ -2918,7 +2922,7 @@ for first matching file."
                                    (ido-all-completions))
                                   (t
                                    (copy-sequence (or ido-matches ido-cur-list)))))))
-           (if ido-xemacs 
+           (if (featurep 'xemacs)
                ;; XEmacs extents are put on by default, doesn't seem to be
                ;; any way of switching them off.
                ;; This obscure code avoids a byte compiler warning in Emacs.
@@ -2996,7 +3000,7 @@ Record command in command-history if optional RECORD is non-nil."
            (select-frame-set-input-focus newframe)
          (raise-frame newframe)
          (select-frame newframe)
-         (if (not ido-xemacs)
+         (unless (featurep 'xemacs)
            (set-mouse-position (selected-frame) (1- (frame-width)) 0)))
        (select-window win))
        (t
@@ -3015,13 +3019,10 @@ Record command in command-history if optional RECORD is non-nil."
       (display-buffer buffer))
 
      ((eq method 'otherframe)
-      (progn
-       (switch-to-buffer-other-frame buffer)
-       (if (not ido-xemacs)
-           (if (fboundp 'select-frame-set-input-focus)
-               (select-frame-set-input-focus (selected-frame))
-             (set-mouse-position (selected-frame) (1- (frame-width)) 0)))
-       )))))
+      (switch-to-buffer-other-frame buffer)
+      (unless (featurep 'xemacs)
+       (select-frame-set-input-focus (selected-frame)))
+      ))))
 
 
 (defun ido-window-buffer-p  (buffer)
@@ -3563,11 +3564,12 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
   "Minibuffer setup hook for `ido'."
   ;; Copied from `icomplete-minibuffer-setup-hook'.
   (when (and (boundp 'ido-completing-read) 
-            (or ido-xemacs (= ido-use-mycompletion-depth (minibuffer-depth))))
+            (or (featurep 'xemacs)
+                (= ido-use-mycompletion-depth (minibuffer-depth))))
     (add-hook 'pre-command-hook 'ido-tidy nil t)
     (add-hook 'post-command-hook 'ido-exhibit nil t)
     (setq cua-inhibit-cua-keys t)
-    (when ido-xemacs
+    (when (featurep 'xemacs)
       (ido-exhibit)
       (goto-char (point-min)))
     (run-hooks 'ido-minibuffer-setup-hook)))
@@ -3617,15 +3619,12 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
 (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."
-  (message "%S %S %S %S" this-command ido-read-file-name-non-ido 
-          predicate (memq this-command ido-read-file-name-non-ido))
   (cond
   ((or (eq predicate 'file-directory-p)
        (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))
        (or (null predicate) (eq predicate 'file-exists-p)))
-   (message "gotit")
    (let (filename
         ido-saved-vc-mt
         (vc-master-templates (and (boundp 'vc-master-templates) vc-master-templates))