diff options
author | Kim F. Storm <storm@cua.dk> | 2006-06-05 22:22:41 +0000 |
---|---|---|
committer | Kim F. Storm <storm@cua.dk> | 2006-06-05 22:22:41 +0000 |
commit | a11ad595d46c0d9251a436695f5f5159575fdafa (patch) | |
tree | a3e7cde41905c18c174c2250d49be67937305f9a /lisp/ido.el | |
parent | 92f0c93da24c16f2dce11043ebd63e1b5fc89713 (diff) | |
download | emacs-a11ad595d46c0d9251a436695f5f5159575fdafa.tar.gz |
(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.
Diffstat (limited to 'lisp/ido.el')
-rw-r--r-- | lisp/ido.el | 111 |
1 files changed, 53 insertions, 58 deletions
diff --git a/lisp/ido.el b/lisp/ido.el index 1c2617b814d..344f8a667a1 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -448,35 +448,41 @@ in merged file and directory lists." ;;; 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 @@ for first matching file." ;;; 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 @@ Record command in `command-history' if optional RECORD is non-nil." (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 @@ Record command in `command-history' if optional RECORD is non-nil." ((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 @@ in a separate window. 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 @@ The buffer name is selected interactively by typing a substring. 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 @@ in a separate window. 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 @@ For details of keybindings, do `\\[describe-function] ido-find-file'." 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 () |