Mercurial > emacs
comparison lisp/ido.el @ 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 | 4429856755f0 |
children | 851a15a8f318 a8190f7e546e |
comparison
equal
deleted
inserted
replaced
71239:613221b49c98 | 71240:0b7ea03b3bcd |
---|---|
446 ;(setq ido-ignore-buffers '("^ " ido-ignore-c-mode)) | 446 ;(setq ido-ignore-buffers '("^ " ido-ignore-c-mode)) |
447 | 447 |
448 ;;; Examples for setting the value of ido-ignore-files | 448 ;;; Examples for setting the value of ido-ignore-files |
449 ;(setq ido-ignore-files '("^ " "\\.c$" "\\.h$")) | 449 ;(setq ido-ignore-files '("^ " "\\.c$" "\\.h$")) |
450 | 450 |
451 (defcustom ido-default-file-method 'always-frame | 451 (defcustom ido-default-file-method 'raise-frame |
452 "*How to switch to new file when using `ido-find-file'. | 452 "*How to visit a new file when using `ido-find-file'. |
453 Possible values: | 453 Possible values: |
454 `samewindow' Show new file in same window | 454 `selected-window' Show new file in selected window |
455 `otherwindow' Show new file in another window (same frame) | 455 `other-window' Show new file in another window (same frame) |
456 `display' Display file in another window without switching to it | 456 `display' Display file in another window without selecting to it |
457 `otherframe' Show new file in another frame | 457 `other-frame' Show new file in another frame |
458 `maybe-frame' If a file is visible in another frame, prompt to ask if you | 458 `maybe-frame' If a file is visible in another frame, prompt to ask if you |
459 you want to see the file in the same window of the current | 459 you want to see the file in the same window of the current |
460 frame or in the other frame | 460 frame or in the other frame |
461 `always-frame' If a file is visible in another frame, raise that | 461 `raise-frame' If a file is visible in another frame, raise that |
462 frame; otherwise, visit the file in the same window" | 462 frame; otherwise, visit the file in the same window" |
463 :type '(choice (const samewindow) | 463 :type '(choice (const :tag "Visit in selected window" selected-window) |
464 (const otherwindow) | 464 (const :tag "Visit in other window" other-window) |
465 (const display) | 465 (const :tag "Display (no select) in other window" display) |
466 (const otherframe) | 466 (const :tag "Visit in other frame" other-frame) |
467 (const maybe-frame) | 467 (const :tag "Ask to visit in other frame" maybe-frame) |
468 (const always-frame)) | 468 (const :tag "Raise frame if already visited" raise-frame)) |
469 :group 'ido) | 469 :group 'ido) |
470 | 470 |
471 (defcustom ido-default-buffer-method 'always-frame | 471 (defcustom ido-default-buffer-method 'raise-frame |
472 "*How to switch to new buffer when using `ido-switch-buffer'. | 472 "*How to switch to new buffer when using `ido-switch-buffer'. |
473 See `ido-default-file-method' for details." | 473 See `ido-default-file-method' for details." |
474 :type '(choice (const samewindow) | 474 :type '(choice (const :tag "Show in selected window" selected-window) |
475 (const otherwindow) | 475 (const :tag "Show in other window" other-window) |
476 (const :tag "Display (no select) in other window" display) | |
477 (const :tag "Show in other frame" other-frame) | |
478 (const :tag "Ask to show in other frame" maybe-frame) | |
479 (const :tag "Raise frame if already shown" raise-frame)) | |
480 :type '(choice (const selected-window) | |
481 (const other-window) | |
476 (const display) | 482 (const display) |
477 (const otherframe) | 483 (const other-frame) |
478 (const maybe-frame) | 484 (const maybe-frame) |
479 (const always-frame)) | 485 (const raise-frame)) |
480 :group 'ido) | 486 :group 'ido) |
481 | 487 |
482 (defcustom ido-enable-flex-matching nil | 488 (defcustom ido-enable-flex-matching nil |
483 "*Non-nil means that `ido' will do flexible string matching. | 489 "*Non-nil means that `ido' will do flexible string matching. |
484 Flexible matching means that if the entered string does not | 490 Flexible matching means that if the entered string does not |
3740 (setq ido-cur-list (delq (car ido-matches) ido-cur-list)))))) | 3746 (setq ido-cur-list (delq (car ido-matches) ido-cur-list)))))) |
3741 | 3747 |
3742 | 3748 |
3743 ;;; VISIT CHOSEN BUFFER | 3749 ;;; VISIT CHOSEN BUFFER |
3744 (defun ido-visit-buffer (buffer method &optional record) | 3750 (defun ido-visit-buffer (buffer method &optional record) |
3745 "Visit file named FILE according to METHOD. | 3751 "Switch to BUFFER according to METHOD. |
3746 Record command in `command-history' if optional RECORD is non-nil." | 3752 Record command in `command-history' if optional RECORD is non-nil." |
3747 | 3753 |
3748 (let (win newframe) | 3754 (let (win newframe) |
3749 (cond | 3755 (cond |
3750 ((eq method 'kill) | 3756 ((eq method 'kill) |
3751 (if record | 3757 (if record |
3752 (ido-record-command 'kill-buffer buffer)) | 3758 (ido-record-command 'kill-buffer buffer)) |
3753 (kill-buffer buffer)) | 3759 (kill-buffer buffer)) |
3754 | 3760 |
3755 ((eq method 'samewindow) | 3761 ((eq method 'other-window) |
3756 (if record | |
3757 (ido-record-command 'switch-to-buffer buffer)) | |
3758 (switch-to-buffer buffer)) | |
3759 | |
3760 ((memq method '(always-frame maybe-frame)) | |
3761 (cond | |
3762 ((and window-system | |
3763 (setq win (ido-window-buffer-p buffer)) | |
3764 (or (eq method 'always-frame) | |
3765 (y-or-n-p "Jump to frame? "))) | |
3766 (setq newframe (window-frame win)) | |
3767 (if (fboundp 'select-frame-set-input-focus) | |
3768 (select-frame-set-input-focus newframe) | |
3769 (raise-frame newframe) | |
3770 (select-frame newframe) | |
3771 (unless (featurep 'xemacs) | |
3772 (set-mouse-position (selected-frame) (1- (frame-width)) 0))) | |
3773 (select-window win)) | |
3774 (t | |
3775 ;; No buffer in other frames... | |
3776 (if record | |
3777 (ido-record-command 'switch-to-buffer buffer)) | |
3778 (switch-to-buffer buffer) | |
3779 ))) | |
3780 | |
3781 ((eq method 'otherwindow) | |
3782 (if record | 3762 (if record |
3783 (ido-record-command 'switch-to-buffer buffer)) | 3763 (ido-record-command 'switch-to-buffer buffer)) |
3784 (switch-to-buffer-other-window buffer)) | 3764 (switch-to-buffer-other-window buffer)) |
3785 | 3765 |
3786 ((eq method 'display) | 3766 ((eq method 'display) |
3787 (display-buffer buffer)) | 3767 (display-buffer buffer)) |
3788 | 3768 |
3789 ((eq method 'otherframe) | 3769 ((eq method 'other-frame) |
3790 (switch-to-buffer-other-frame buffer) | 3770 (switch-to-buffer-other-frame buffer) |
3791 (unless (featurep 'xemacs) | 3771 (select-frame-set-input-focus (selected-frame))) |
3792 (select-frame-set-input-focus (selected-frame))) | 3772 |
3773 ((and (memq method '(raise-frame maybe-frame)) | |
3774 window-system | |
3775 (setq win (ido-buffer-window-other-frame buffer)) | |
3776 (or (eq method 'raise-frame) | |
3777 (y-or-n-p "Jump to frame? "))) | |
3778 (setq newframe (window-frame win)) | |
3779 (select-frame-set-input-focus newframe) | |
3780 (select-window win)) | |
3781 | |
3782 ;; (eq method 'selected-window) | |
3783 (t | |
3784 ;; No buffer in other frames... | |
3785 (if record | |
3786 (ido-record-command 'switch-to-buffer buffer)) | |
3787 (switch-to-buffer buffer) | |
3793 )))) | 3788 )))) |
3794 | 3789 |
3795 | 3790 |
3796 (defun ido-window-buffer-p (buffer) | 3791 (defun ido-buffer-window-other-frame (buffer) |
3797 ;; Return window pointer if BUFFER is visible in another frame. | 3792 ;; Return window pointer if BUFFER is visible in another frame. |
3798 ;; If BUFFER is visible in the current frame, return nil. | 3793 ;; If BUFFER is visible in the current frame, return nil. |
3799 (let ((blist (ido-get-buffers-in-frames 'current))) | 3794 (let ((blist (ido-get-buffers-in-frames 'current))) |
3800 ;;If the buffer is visible in current frame, return nil | 3795 ;;If the buffer is visible in current frame, return nil |
3801 (if (member buffer blist) | 3796 (if (member buffer blist) |
3848 (defun ido-switch-buffer-other-window () | 3843 (defun ido-switch-buffer-other-window () |
3849 "Switch to another buffer and show it in another window. | 3844 "Switch to another buffer and show it in another window. |
3850 The buffer name is selected interactively by typing a substring. | 3845 The buffer name is selected interactively by typing a substring. |
3851 For details of keybindings, do `\\[describe-function] ido'." | 3846 For details of keybindings, do `\\[describe-function] ido'." |
3852 (interactive) | 3847 (interactive) |
3853 (ido-buffer-internal 'otherwindow 'switch-to-buffer-other-window)) | 3848 (ido-buffer-internal 'other-window 'switch-to-buffer-other-window)) |
3854 | 3849 |
3855 ;;;###autoload | 3850 ;;;###autoload |
3856 (defun ido-display-buffer () | 3851 (defun ido-display-buffer () |
3857 "Display a buffer in another window but don't select it. | 3852 "Display a buffer in another window but don't select it. |
3858 The buffer name is selected interactively by typing a substring. | 3853 The buffer name is selected interactively by typing a substring. |
3881 "Switch to another buffer and show it in another frame. | 3876 "Switch to another buffer and show it in another frame. |
3882 The buffer name is selected interactively by typing a substring. | 3877 The buffer name is selected interactively by typing a substring. |
3883 For details of keybindings, do `\\[describe-function] ido'." | 3878 For details of keybindings, do `\\[describe-function] ido'." |
3884 (interactive) | 3879 (interactive) |
3885 (if ido-mode | 3880 (if ido-mode |
3886 (ido-buffer-internal 'otherframe) | 3881 (ido-buffer-internal 'other-frame) |
3887 (call-interactively 'switch-to-buffer-other-frame))) | 3882 (call-interactively 'switch-to-buffer-other-frame))) |
3888 | 3883 |
3889 ;;;###autoload | 3884 ;;;###autoload |
3890 (defun ido-find-file-in-dir (dir) | 3885 (defun ido-find-file-in-dir (dir) |
3891 "Switch to another file starting from DIR." | 3886 "Switch to another file starting from DIR." |
3943 (defun ido-find-file-other-window () | 3938 (defun ido-find-file-other-window () |
3944 "Switch to another file and show it in another window. | 3939 "Switch to another file and show it in another window. |
3945 The file name is selected interactively by typing a substring. | 3940 The file name is selected interactively by typing a substring. |
3946 For details of keybindings, do `\\[describe-function] ido-find-file'." | 3941 For details of keybindings, do `\\[describe-function] ido-find-file'." |
3947 (interactive) | 3942 (interactive) |
3948 (ido-file-internal 'otherwindow 'find-file-other-window)) | 3943 (ido-file-internal 'other-window 'find-file-other-window)) |
3949 | 3944 |
3950 ;;;###autoload | 3945 ;;;###autoload |
3951 (defun ido-find-alternate-file () | 3946 (defun ido-find-alternate-file () |
3952 "Switch to another file and show it in another window. | 3947 "Switch to another file and show it in another window. |
3953 The file name is selected interactively by typing a substring. | 3948 The file name is selected interactively by typing a substring. |
3991 (defun ido-find-file-other-frame () | 3986 (defun ido-find-file-other-frame () |
3992 "Switch to another file and show it in another frame. | 3987 "Switch to another file and show it in another frame. |
3993 The file name is selected interactively by typing a substring. | 3988 The file name is selected interactively by typing a substring. |
3994 For details of keybindings, do `\\[describe-function] ido-find-file'." | 3989 For details of keybindings, do `\\[describe-function] ido-find-file'." |
3995 (interactive) | 3990 (interactive) |
3996 (ido-file-internal 'otherframe 'find-file-other-frame)) | 3991 (ido-file-internal 'other-frame 'find-file-other-frame)) |
3997 | 3992 |
3998 ;;;###autoload | 3993 ;;;###autoload |
3999 (defun ido-write-file () | 3994 (defun ido-write-file () |
4000 "Write current buffer to a file. | 3995 "Write current buffer to a file. |
4001 The file name is selected interactively by typing a substring. | 3996 The file name is selected interactively by typing a substring. |