diff options
author | Philipp Stephani <phst@google.com> | 2017-04-20 15:41:15 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2017-04-23 18:42:42 +0200 |
commit | a1f93c1dfa53dbe007faa09ab0c6e913e86e3ffe (patch) | |
tree | 4468a3c2fa5e83ced8a42378e4b2453199d1f5b8 /lisp/ido.el | |
parent | a02885a37031ec0e199dcb38ff9cb93e65e7b7cb (diff) | |
download | emacs-a1f93c1dfa53dbe007faa09ab0c6e913e86e3ffe.tar.gz |
Add missing remappings for Ido mode
Among others, add a remapping for C-x 4 d, cf. Bug#26360.
* lisp/ido.el (ido-mode): Remap missing commands.
(ido-file-internal, ido-visit-buffer): Add support for new
methods.
(ido-display-buffer-other-frame)
(ido-find-alternate-file-other-window, ido-dired-other-window)
(ido-dired-other-frame): New commands.
* test/lisp/ido-tests.el (ido-tests--other-window-frame): Add unit
test for the bindings.
Diffstat (limited to 'lisp/ido.el')
-rw-r--r-- | lisp/ido.el | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/lisp/ido.el b/lisp/ido.el index 293c8e28570..318f2fe082a 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1640,10 +1640,14 @@ This function also adds a hook to the minibuffer." 'ido-find-file-other-window) (define-key map [remap find-file-read-only-other-window] 'ido-find-file-read-only-other-window) + (define-key map [remap find-alternate-file-other-window] + #'ido-find-alternate-file-other-window) + (define-key map [remap dired-other-window] #'ido-dired-other-window) (define-key map [remap find-file-other-frame] 'ido-find-file-other-frame) (define-key map [remap find-file-read-only-other-frame] - 'ido-find-file-read-only-other-frame)) + 'ido-find-file-read-only-other-frame) + (define-key map [remap dired-other-frame] #'ido-dired-other-frame)) (when (memq ido-mode '(buffer both)) (define-key map [remap switch-to-buffer] 'ido-switch-buffer) @@ -1653,7 +1657,9 @@ This function also adds a hook to the minibuffer." 'ido-switch-buffer-other-frame) (define-key map [remap insert-buffer] 'ido-insert-buffer) (define-key map [remap kill-buffer] 'ido-kill-buffer) - (define-key map [remap display-buffer] 'ido-display-buffer)) + (define-key map [remap display-buffer] 'ido-display-buffer) + (define-key map [remap display-buffer-other-frame] + #'ido-display-buffer-other-frame)) (if ido-minor-mode-map-entry (setcdr ido-minor-mode-map-entry map) @@ -2443,7 +2449,14 @@ If cursor is not at the end of the user input, move to end of input." (ido-record-work-directory) (find-alternate-file filename)) - ((memq method '(dired list-directory)) + ((eq method 'alt-file-other-window) + (ido-record-work-file filename) + (setq default-directory ido-current-directory) + (ido-record-work-directory) + (find-alternate-file-other-window filename)) + + ((memq method '(dired dired-other-window dired-other-frame + list-directory)) (if (equal filename ".") (setq filename "")) (let* ((dirname (ido-final-slash @@ -4108,6 +4121,9 @@ Record command in `command-history' if optional RECORD is non-nil." (switch-to-buffer-other-frame buffer) (select-frame-set-input-focus (selected-frame))) + ((eq method 'display-other-frame) + (display-buffer-other-frame buffer)) + ((and (memq method '(raise-frame maybe-frame)) window-system (setq win (ido-buffer-window-other-frame buffer)) @@ -4193,6 +4209,15 @@ For details of keybindings, see `ido-switch-buffer'." (ido-buffer-internal 'display 'display-buffer nil nil nil 'ignore)) ;;;###autoload +(defun ido-display-buffer-other-frame () + "Display a buffer preferably in another frame. +The buffer name is selected interactively by typing a substring. +For details of keybindings, see `ido-switch-buffer'." + (interactive) + (ido-buffer-internal 'display-other-frame #'display-buffer-other-frame + nil nil nil #'ignore)) + +;;;###autoload (defun ido-kill-buffer () "Kill a buffer. The buffer name is selected interactively by typing a substring. @@ -4291,6 +4316,14 @@ For details of keybindings, see `ido-find-file'." (ido-file-internal 'alt-file 'find-alternate-file nil "Find alternate file: ")) ;;;###autoload +(defun ido-find-alternate-file-other-window () + "Find file as a replacement for the file in the next window. +The file name is selected interactively by typing a substring. +For details of keybindings, see `ido-find-file'." + (interactive) + (ido-file-internal 'alt-file-other-window #'find-alternate-file-other-window)) + +;;;###autoload (defun ido-find-file-read-only () "Edit file read-only with name obtained via minibuffer. The file name is selected interactively by typing a substring. @@ -4364,6 +4397,28 @@ For details of keybindings, see `ido-find-file'." (ido-auto-merge-work-directories-length -1)) (ido-file-internal 'dired 'dired nil "Dired: " 'dir))) +;;;###autoload +(defun ido-dired-other-window () + "\"Edit\" a directory. Like `ido-dired' but selects in another window. +The directory is selected interactively by typing a substring. +For details of keybindings, see `ido-find-file'." + (interactive) + (let ((ido-report-no-match nil) + (ido-auto-merge-work-directories-length -1)) + (ido-file-internal 'dired-other-window #'dired-other-window nil + "Dired: " 'dir))) + +;;;###autoload +(defun ido-dired-other-frame () + "\"Edit\" a directory. Like `ido-dired' but makes a new frame. +The directory is selected interactively by typing a substring. +For details of keybindings, see `ido-find-file'." + (interactive) + (let ((ido-report-no-match nil) + (ido-auto-merge-work-directories-length -1)) + (ido-file-internal 'dired-other-frame #'dired-other-frame nil + "Dired: " 'dir))) + (defun ido-list-directory () "Call `list-directory' the Ido way. The directory is selected interactively by typing a substring. |