;;; ido.el --- interactively do things with buffers and files.
;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Author: Kim F. Storm <storm@cua.dk>
;; Based on: iswitchb by Stephen Eglen <stephen@cns.ed.ac.uk>
:type '(repeat (choice regexp function))
:group 'ido)
-;;; Examples for setting the value of ido-ignore-buffers
-;(defun ido-ignore-c-mode (name)
-; "Ignore all c mode buffers -- example function for ido."
-; (save-excursion
-; (set-buffer name)
-; (string-match "^C$" mode-name)))
-;
-;(setq ido-ignore-buffers '("^ " ido-ignore-c-mode))
+;; Examples for setting the value of ido-ignore-buffers
+;;(defun ido-ignore-c-mode (name)
+;; "Ignore all c mode buffers -- example function for ido."
+;; (with-current-buffer name
+;; (derived-mode-p 'c-mode)))
+;;
+;;(setq ido-ignore-buffers '("^ " ido-ignore-c-mode))
-;;; Examples for setting the value of ido-ignore-files
-;(setq ido-ignore-files '("^ " "\\.c$" "\\.h$"))
+;; Examples for setting the value of ido-ignore-files
+;;(setq ido-ignore-files '("^ " "\\.c\\'" "\\.h\\'"))
(defcustom ido-default-file-method 'raise-frame
"*How to visit a new file when using `ido-find-file'.
;;; Magic C-f
-(defun ido-magic-forward-char ()
+(defun ido-magic-forward-char (arg)
"Move forward in user input or perform magic action.
If no user input is present, or at end of input, perform magic actions:
C-x C-b ... C-f switch to ido-find-file.
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)
+ (interactive "P")
(cond
- ((not (eobp))
- (forward-char 1))
+ ((or arg (not (eobp)))
+ (forward-char (min (prefix-numeric-value arg)
+ (- (point-max) (point)))))
((memq ido-cur-item '(file dir))
(ido-fallback-command))
(ido-context-switch-command
;;; Magic C-b
-(defun ido-magic-backward-char ()
+(defun ido-magic-backward-char (arg)
"Move backward in user input or perform magic action.
If no user input is present, or at start of input, perform magic actions:
C-x C-f C-b switch to `ido-switch-buffer'.
C-x C-d C-b switch to `ido-switch-buffer'.
C-x d C-b switch to `ido-switch-buffer'.
C-x C-b C-b fallback to non-ido `switch-to-buffer'."
- (interactive)
+ (interactive "P")
(cond
- ((> (point) (minibuffer-prompt-end))
- (forward-char -1))
+ ((or arg (> (point) (minibuffer-prompt-end)))
+ (forward-char
+ (- (min (prefix-numeric-value arg)
+ (- (point) (minibuffer-prompt-end))))))
((eq last-command this-command)
(when (and (memq ido-cur-item '(file dir))
(not (bobp)))
;;; Magic C-d
-(defun ido-magic-delete-char ()
+(defun ido-magic-delete-char (arg)
"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)
+ (interactive "P")
(cond
- ((not (eobp))
- (delete-char 1))
+ ((or arg (not (eobp)))
+ (delete-char (min (prefix-numeric-value arg)
+ (- (point-max) (point)))))
(ido-context-switch-command
nil)
((memq ido-cur-item '(file dir))
(ido-read-internal 'list prompt hist def require-match initial-input)))
-;;; arch-tag: b63a3500-1735-41bd-8a01-05373f0864da
+;; arch-tag: b63a3500-1735-41bd-8a01-05373f0864da
;;; ido.el ends here