comparison lisp/ido.el @ 62537:43a311177040

(ido-magic-forward-char): Enter ido-find-file at end of input. (ido-magic-backward-char): Enter ido-switch-buffer at start of input.
author Kim F. Storm <storm@cua.dk>
date Thu, 19 May 2005 21:08:14 +0000
parents 4d270efed583
children d1cbfe7309c1 f042e7c0fe20
comparison
equal deleted inserted replaced
62536:d8f2a91300fa 62537:43a311177040
2265 2265
2266 ;;; Magic C-f 2266 ;;; Magic C-f
2267 2267
2268 (defun ido-magic-forward-char () 2268 (defun ido-magic-forward-char ()
2269 "Move forward in user input or perform magic action. 2269 "Move forward in user input or perform magic action.
2270 If no user input is present, perform magic actions: 2270 If no user input is present or at end of input, perform magic actions:
2271 C-x C-f C-f fallback to non-ido find-file. 2271 C-x C-b ... C-f switch to ido-find-file.
2272 C-x C-d C-f fallback to non-ido brief dired. 2272 C-x C-f ... C-f fallback to non-ido find-file.
2273 C-x d C-f fallback to non-ido dired." 2273 C-x C-d ... C-f fallback to non-ido brief dired.
2274 C-x d ... C-f fallback to non-ido dired."
2274 (interactive) 2275 (interactive)
2275 (cond 2276 (cond
2276 ((not (eobp)) 2277 ((not (eobp))
2277 (forward-char 1)) 2278 (forward-char 1))
2278 ((and (= (length ido-text) 0) 2279 ((memq ido-cur-item '(file dir))
2279 (memq ido-cur-item '(file dir))) 2280 (ido-fallback-command))
2280 (ido-fallback-command)))) 2281 (ido-context-switch-command
2282 (call-interactively ido-context-switch-command))
2283 ((eq ido-cur-item 'buffer)
2284 (ido-enter-find-file))))
2281 2285
2282 ;;; Magic C-b 2286 ;;; Magic C-b
2283 2287
2284 (defun ido-magic-backward-char () 2288 (defun ido-magic-backward-char ()
2285 "Move backward in user input or perform magic action. 2289 "Move backward in user input or perform magic action.
2286 If no user input is present, perform magic actions: 2290 If no user input is present, or at start of input, perform magic actions:
2291 C-x C-f C-b switch to ido-switch-buffer.
2292 C-x C-d C-b switch to ido-switch-buffer.
2293 C-x d C-b switch to ido-switch-buffer.
2287 C-x C-b C-b fallback to non-ido switch-to-buffer." 2294 C-x C-b C-b fallback to non-ido switch-to-buffer."
2288 (interactive) 2295 (interactive)
2289 (cond 2296 (cond
2290 ((> (length ido-text) 0) 2297 ((> (point) (minibuffer-prompt-end))
2291 (if (> (point) (minibuffer-prompt-end)) 2298 (forward-char -1))
2292 (forward-char -1)))
2293 ((eq ido-cur-item 'buffer) 2299 ((eq ido-cur-item 'buffer)
2294 (ido-fallback-command)))) 2300 (ido-fallback-command))
2301 (ido-context-switch-command
2302 (call-interactively ido-context-switch-command))
2303 (t
2304 (ido-enter-switch-buffer))))
2295 2305
2296 ;;; Magic C-d 2306 ;;; Magic C-d
2297 2307
2298 (defun ido-magic-delete-char () 2308 (defun ido-magic-delete-char ()
2299 "Delete following char in user input or perform magic action. 2309 "Delete following char in user input or perform magic action.