changeset 71240:0b7ea03b3bcd

(ido-default-file-method, ido-default-buffer-method): Make choice values consistent with corresponding command names. (ido-visit-buffer): Update accordingly. Default to selected-window.
author Kim F. Storm <storm@cua.dk>
date Mon, 05 Jun 2006 22:22:41 +0000
parents 613221b49c98
children 11061a67f09a
files lisp/ido.el
diffstat 1 files changed, 53 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ido.el	Mon Jun 05 22:22:27 2006 +0000
+++ b/lisp/ido.el	Mon Jun 05 22:22:41 2006 +0000
@@ -448,35 +448,41 @@
 ;;; Examples for setting the value of ido-ignore-files
 ;(setq ido-ignore-files '("^ " "\\.c$" "\\.h$"))
 
-(defcustom ido-default-file-method  'always-frame
-    "*How to switch to new file when using `ido-find-file'.
+(defcustom ido-default-file-method  'raise-frame
+    "*How to visit a new file when using `ido-find-file'.
 Possible values:
-`samewindow'	Show new file in same window
-`otherwindow'	Show new file in another window (same frame)
-`display'	Display file in another window without switching to it
-`otherframe'	Show new file in another frame
-`maybe-frame'	If a file is visible in another frame, prompt to ask if you
-		you want to see the file in the same window of the current
-  		frame or in the other frame
-`always-frame'  If a file is visible in another frame, raise that
-		frame; otherwise, visit the file in the same window"
-    :type '(choice (const samewindow)
-		   (const otherwindow)
-		   (const display)
-		   (const otherframe)
-		   (const maybe-frame)
-		   (const always-frame))
+`selected-window' Show new file in selected window
+`other-window'	  Show new file in another window (same frame)
+`display'	  Display file in another window without selecting to it
+`other-frame'	  Show new file in another frame
+`maybe-frame'	  If a file is visible in another frame, prompt to ask if you
+		  you want to see the file in the same window of the current
+  		  frame or in the other frame
+`raise-frame'     If a file is visible in another frame, raise that
+		  frame; otherwise, visit the file in the same window"
+    :type '(choice (const :tag "Visit in selected window" selected-window)
+		   (const :tag "Visit in other window" other-window)
+		   (const :tag "Display (no select) in other window" display)
+		   (const :tag "Visit in other frame" other-frame)
+		   (const :tag "Ask to visit in other frame" maybe-frame)
+		   (const :tag "Raise frame if already visited" raise-frame))
     :group 'ido)
 
-(defcustom ido-default-buffer-method  'always-frame
+(defcustom ido-default-buffer-method  'raise-frame
     "*How to switch to new buffer when using `ido-switch-buffer'.
 See `ido-default-file-method' for details."
-    :type '(choice (const samewindow)
-		   (const otherwindow)
+    :type '(choice (const :tag "Show in selected window" selected-window)
+		   (const :tag "Show in other window" other-window)
+		   (const :tag "Display (no select) in other window" display)
+		   (const :tag "Show in other frame" other-frame)
+		   (const :tag "Ask to show in other frame" maybe-frame)
+		   (const :tag "Raise frame if already shown" raise-frame))
+    :type '(choice (const selected-window)
+		   (const other-window)
 		   (const display)
-		   (const otherframe)
+		   (const other-frame)
 		   (const maybe-frame)
-		   (const always-frame))
+		   (const raise-frame))
     :group 'ido)
 
 (defcustom ido-enable-flex-matching nil
@@ -3742,7 +3748,7 @@
 
 ;;; VISIT CHOSEN BUFFER
 (defun ido-visit-buffer (buffer method &optional record)
-  "Visit file named FILE according to METHOD.
+  "Switch to BUFFER according to METHOD.
 Record command in `command-history' if optional RECORD is non-nil."
 
   (let (win newframe)
@@ -3752,33 +3758,7 @@
 	  (ido-record-command 'kill-buffer buffer))
       (kill-buffer buffer))
 
-     ((eq method 'samewindow)
-      (if record
-	  (ido-record-command 'switch-to-buffer buffer))
-      (switch-to-buffer buffer))
-
-     ((memq method '(always-frame maybe-frame))
-      (cond
-       ((and window-system
-	     (setq win (ido-window-buffer-p buffer))
-	     (or (eq method 'always-frame)
-		 (y-or-n-p "Jump to frame? ")))
-	(setq newframe (window-frame win))
-	(if (fboundp 'select-frame-set-input-focus)
-	    (select-frame-set-input-focus newframe)
-	  (raise-frame newframe)
-	  (select-frame newframe)
-	  (unless (featurep 'xemacs)
-	    (set-mouse-position (selected-frame) (1- (frame-width)) 0)))
-	(select-window win))
-       (t
-	;;  No buffer in other frames...
-	(if record
-	    (ido-record-command 'switch-to-buffer buffer))
-	(switch-to-buffer buffer)
-	)))
-
-     ((eq method 'otherwindow)
+     ((eq method 'other-window)
       (if record
 	  (ido-record-command 'switch-to-buffer buffer))
       (switch-to-buffer-other-window buffer))
@@ -3786,14 +3766,29 @@
      ((eq method 'display)
       (display-buffer buffer))
 
-     ((eq method 'otherframe)
+     ((eq method 'other-frame)
       (switch-to-buffer-other-frame buffer)
-      (unless (featurep 'xemacs)
-	(select-frame-set-input-focus (selected-frame)))
+      (select-frame-set-input-focus (selected-frame)))
+
+     ((and (memq method '(raise-frame maybe-frame))
+	   window-system
+	   (setq win (ido-buffer-window-other-frame buffer))
+	   (or (eq method 'raise-frame)
+	       (y-or-n-p "Jump to frame? ")))
+      (setq newframe (window-frame win))
+      (select-frame-set-input-focus newframe)
+      (select-window win))
+
+     ;; (eq method 'selected-window)
+     (t
+      ;;  No buffer in other frames...
+      (if record
+	  (ido-record-command 'switch-to-buffer buffer))
+      (switch-to-buffer buffer)
       ))))
 
 
-(defun ido-window-buffer-p  (buffer)
+(defun ido-buffer-window-other-frame  (buffer)
   ;; Return window pointer if BUFFER is visible in another frame.
   ;; If BUFFER is visible in the current frame, return nil.
   (let ((blist (ido-get-buffers-in-frames 'current)))
@@ -3850,7 +3845,7 @@
 The buffer name is selected interactively by typing a substring.
 For details of keybindings, do `\\[describe-function] ido'."
   (interactive)
-  (ido-buffer-internal 'otherwindow 'switch-to-buffer-other-window))
+  (ido-buffer-internal 'other-window 'switch-to-buffer-other-window))
 
 ;;;###autoload
 (defun ido-display-buffer ()
@@ -3883,7 +3878,7 @@
 For details of keybindings, do `\\[describe-function] ido'."
   (interactive)
   (if ido-mode
-      (ido-buffer-internal 'otherframe)
+      (ido-buffer-internal 'other-frame)
     (call-interactively 'switch-to-buffer-other-frame)))
 
 ;;;###autoload
@@ -3945,7 +3940,7 @@
 The file name is selected interactively by typing a substring.
 For details of keybindings, do `\\[describe-function] ido-find-file'."
   (interactive)
-  (ido-file-internal 'otherwindow 'find-file-other-window))
+  (ido-file-internal 'other-window 'find-file-other-window))
 
 ;;;###autoload
 (defun ido-find-alternate-file ()
@@ -3993,7 +3988,7 @@
 The file name is selected interactively by typing a substring.
 For details of keybindings, do `\\[describe-function] ido-find-file'."
   (interactive)
-  (ido-file-internal 'otherframe 'find-file-other-frame))
+  (ido-file-internal 'other-frame 'find-file-other-frame))
 
 ;;;###autoload
 (defun ido-write-file ()