(mail-interactive): Change default.
[bpt/emacs.git] / lisp / ido.el
index 750eb6e..d4a8478 100644 (file)
@@ -9,10 +9,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +20,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 
 ;;; Commentary:
@@ -1317,7 +1315,6 @@ Value is an integer which is number of chars to right of prompt.")
            (if (listp ido-unc-hosts-cache)
                (ido-pp 'ido-unc-hosts-cache)
              (insert "\n;; ----- ido-unc-hosts-cache -----\nt\n"))
-           (insert "\n")
            (write-file ido-save-directory-list-file nil))
        (kill-buffer buf)))))
 
@@ -2537,17 +2534,18 @@ If no merge has yet taken place, toggle automatic merging option."
 
 ;;; 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
@@ -2557,17 +2555,19 @@ C-x d ... C-f    fallback to non-ido dired."
 
 ;;; 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)))
@@ -2581,14 +2581,15 @@ C-x C-b C-b  fallback to non-ido `switch-to-buffer'."
 
 ;;; 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))