[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/ido.el
From: |
Kim F . Storm |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/ido.el |
Date: |
Sun, 15 May 2005 19:03:36 -0400 |
Index: emacs/lisp/ido.el
diff -c emacs/lisp/ido.el:1.55 emacs/lisp/ido.el:1.56
*** emacs/lisp/ido.el:1.55 Thu May 5 22:15:58 2005
--- emacs/lisp/ido.el Sun May 15 23:03:36 2005
***************
*** 1392,1401 ****
(define-key map [left] 'ido-prev-match)
(define-key map "?" 'ido-completion-help)
(when (memq ido-cur-item '(file dir))
! (define-key map "\C-b" (or ido-context-switch-command
'ido-enter-switch-buffer))
! (define-key map "\C-d" (or (and ido-context-switch-command 'ignore)
'ido-enter-dired))
! (define-key map "\C-f" 'ido-fallback-command)
(define-key map [down] 'ido-next-match-dir)
(define-key map [up] 'ido-prev-match-dir)
(define-key map [(meta up)] 'ido-prev-work-directory)
--- 1392,1406 ----
(define-key map [left] 'ido-prev-match)
(define-key map "?" 'ido-completion-help)
+ ;; Magic commands.
+ (define-key map "\C-b" 'ido-magic-backward-char)
+ (define-key map "\C-f" 'ido-magic-forward-char)
+ (define-key map "\C-d" 'ido-magic-delete-char)
+
(when (memq ido-cur-item '(file dir))
! (define-key map "\C-x\C-b" (or ido-context-switch-command
'ido-enter-switch-buffer))
! (define-key map "\C-x\C-f" 'ido-fallback-command)
! (define-key map "\C-x\C-d" (or (and ido-context-switch-command 'ignore)
'ido-enter-dired))
(define-key map [down] 'ido-next-match-dir)
(define-key map [up] 'ido-prev-match-dir)
(define-key map [(meta up)] 'ido-prev-work-directory)
***************
*** 1405,1411 ****
(define-key map [(meta backspace)] 'ido-delete-backward-word-updir)
(define-key map [(control backspace)] 'ido-up-directory)
(define-key map "\C-l" 'ido-reread-directory)
! (define-key map [(meta ?d)] 'ido-wide-find-dir)
(define-key map [(meta ?b)] 'ido-push-dir)
(define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir)
(define-key map [(meta ?k)] 'ido-forget-work-directory)
--- 1410,1416 ----
(define-key map [(meta backspace)] 'ido-delete-backward-word-updir)
(define-key map [(control backspace)] 'ido-up-directory)
(define-key map "\C-l" 'ido-reread-directory)
! (define-key map [(meta ?d)] 'ido-wide-find-dir-or-delete-dir)
(define-key map [(meta ?b)] 'ido-push-dir)
(define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir)
(define-key map [(meta ?k)] 'ido-forget-work-directory)
***************
*** 1426,1433 ****
)
(when (eq ido-cur-item 'buffer)
! (define-key map "\C-f" (or ido-context-switch-command
'ido-enter-find-file))
! (define-key map "\C-b" 'ido-fallback-command)
(define-key map "\C-k" 'ido-kill-buffer-at-head)
)
--- 1431,1438 ----
)
(when (eq ido-cur-item 'buffer)
! (define-key map "\C-x\C-f" (or ido-context-switch-command
'ido-enter-find-file))
! (define-key map "\C-x\C-b" 'ido-fallback-command)
(define-key map "\C-k" 'ido-kill-buffer-at-head)
)
***************
*** 2258,2263 ****
--- 2263,2314 ----
((not ido-use-merged-list)
(ido-merge-work-directories))))
+ ;;; Magic C-f
+
+ (defun ido-magic-forward-char ()
+ "Move forward in user input or perform magic action.
+ If no user input is present, perform magic actions:
+ C-x C-f C-f fallback to non-ido find-file.
+ C-x C-d C-f fallback to non-ido brief dired.
+ C-x d C-f fallback to non-ido dired."
+ (interactive)
+ (cond
+ ((not (eobp))
+ (forward-char 1))
+ ((and (= (length ido-text) 0)
+ (memq ido-cur-item '(file dir)))
+ (ido-fallback-command))))
+
+ ;;; Magic C-b
+
+ (defun ido-magic-backward-char ()
+ "Move backward in user input or perform magic action.
+ If no user input is present, perform magic actions:
+ C-x C-b C-b fallback to non-ido switch-to-buffer."
+ (interactive)
+ (cond
+ ((> (length ido-text) 0)
+ (if (> (point) (minibuffer-prompt-end))
+ (forward-char -1)))
+ ((eq ido-cur-item 'buffer)
+ (ido-fallback-command))))
+
+ ;;; Magic C-d
+
+ (defun ido-magic-delete-char ()
+ "Delete following char in user input or perform magic action.
+ If at end of user input, perform magic actions:
+ C-x C-f ... C-d enter dired on current directory."
+ (interactive)
+ (cond
+ ((not (eobp))
+ (delete-char 1))
+ (ido-context-switch-command
+ nil)
+ ((memq ido-cur-item '(file dir))
+ (ido-enter-dired))))
+
+
;;; TOGGLE FUNCTIONS
(defun ido-toggle-case ()
***************
*** 2505,2510 ****
--- 2556,2569 ----
(setq ido-rotate-temp t)
(exit-minibuffer)))
+ (defun ido-wide-find-dir-or-delete-dir (&optional dir)
+ "Prompt for DIR to search for using find, starting from current directory.
+ If input stack is non-empty, delete current directory component."
+ (interactive)
+ (if ido-input-stack
+ (ido-delete-backward-word-updir 1)
+ (ido-wide-find-dir)))
+
(defun ido-push-dir ()
"Move to previous directory in file name, push current input on stack."
(interactive)
***************
*** 4077,4082 ****
--- 4136,4142 ----
;;; Helper functions for other programs
(put 'dired-do-rename 'ido 'ignore)
+ (put 'ibuffer-find-file 'ido 'find-file)
;;;###autoload
(defun ido-read-buffer (prompt &optional default require-match)
***************
*** 4111,4117 ****
(not (memq this-command ido-read-file-name-non-ido))
(or (null predicate) (eq predicate 'file-exists-p)))
(let* (ido-saved-vc-hb
! (ido-context-switch-command 'ignore)
(vc-handled-backends (and (boundp 'vc-handled-backends)
vc-handled-backends))
(ido-current-directory (ido-expand-directory dir))
(ido-directory-nonreadable (not (file-readable-p
ido-current-directory)))
--- 4171,4178 ----
(not (memq this-command ido-read-file-name-non-ido))
(or (null predicate) (eq predicate 'file-exists-p)))
(let* (ido-saved-vc-hb
! (ido-context-switch-command
! (if (eq (get this-command 'ido) 'find-file) nil 'ignore))
(vc-handled-backends (and (boundp 'vc-handled-backends)
vc-handled-backends))
(ido-current-directory (ido-expand-directory dir))
(ido-directory-nonreadable (not (file-readable-p
ido-current-directory)))
***************
*** 4126,4131 ****
--- 4187,4194 ----
(cond
((eq ido-exit 'fallback)
(setq filename 'fallback))
+ ((eq ido-exit 'dired)
+ (setq filename ido-current-directory))
(filename
(setq filename
(concat ido-current-directory filename))))))