Merge from emacs--rel--22
[bpt/emacs.git] / lisp / emulation / vip.el
index af87808..cec6233 100644 (file)
@@ -1,7 +1,7 @@
 ;;; vip.el --- a VI Package for GNU Emacs
 
-;; Copyright (C) 1986, 1987, 1988, 1992, 1993, 1998, 2005
-;;        Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1987, 1988, 1992, 1993, 1998, 2001, 2002, 2003,
+;;   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Masahiko Sato <ms@sail.stanford.edu>
 ;; Keywords: emulations
@@ -10,7 +10,7 @@
 
 ;; 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 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -20,8 +20,8 @@
 
 ;; 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., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -45,7 +45,7 @@
 ;; external variables
 
 (defvar vip-emacs-local-map nil
-  "Local map used in emacs mode.  (Buffer-specific.)")
+  "Local map used in Emacs mode.  (Buffer-specific.)")
 
 (defvar vip-insert-local-map nil
   "Local map used in insert command mode.  (Buffer-specific.)")
@@ -447,7 +447,7 @@ Type `n' to quit this window for now.\n")
   (vip-change-mode 'insert-mode))
 
 (defun vip-change-mode-to-emacs ()
-  "Change mode to emacs mode."
+  "Change mode to Emacs mode."
   (interactive)
   (vip-change-mode 'emacs-mode))
 
@@ -836,7 +836,7 @@ is the name of the register for COM."
        ((= char ?q)
         (set-mark vip-com-point)
         (vip-quote-region))
-       ((= char ?s) (spell-region vip-com-point (point)))))
+       ((= char ?s) (ispell-region vip-com-point (point)))))
 
 \f
 ;; undoing
@@ -874,7 +874,7 @@ is the name of the register for COM."
     (set-mark beg))
   (beginning-of-line)
   (exchange-point-and-mark)
-  (if (or (not (eobp)) (not (bolp))) (next-line 1))
+  (if (or (not (eobp)) (not (bolp))) (with-no-warnings (next-line 1)))
   (beginning-of-line)
   (if (> beg end) (exchange-point-and-mark)))
 
@@ -893,7 +893,7 @@ is the name of the register for COM."
 each line in the region."
   (setq vip-quote-string
        (let ((str
-              (vip-read-string (format "quote string \(default \"%s\"\): "
+              (vip-read-string (format "quote string (default %s): "
                                        vip-quote-string))))
          (if (string= str "") vip-quote-string str)))
   (vip-enlarge-region (point) (mark))
@@ -1050,7 +1050,7 @@ command was invoked with argument > 1."
 (defun vip-line (arg)
   (let ((val (car arg)) (com (cdr arg)))
     (move-marker vip-com-point (point))
-    (next-line (1- val))
+    (with-no-warnings (next-line (1- val)))
     (vip-execute-com 'vip-line val com)))
 
 (defun vip-yank-line (arg)
@@ -1112,9 +1112,10 @@ the query replace mode will toggle between string replace and regexp replace."
            (replace-match (vip-read-string
                            (format "Replace regexp \"%s\" with: " str))
                           nil nil))
-       (replace-string
-        str
-        (vip-read-string (format "Replace \"%s\" with: " str)))))))
+       (with-no-warnings
+         (replace-string
+          str
+          (vip-read-string (format "Replace \"%s\" with: " str))))))))
 
 \f
 ;; basic cursor movement.  j, k, l, m commands.
@@ -1262,7 +1263,7 @@ beginning of buffer, stop and signal error."
   (interactive "P")
   (let ((val (vip-p-val arg)) (com (vip-getCom arg)))
     (if com (move-marker vip-com-point (point)))
-    (next-line val)
+    (with-no-warnings (next-line val))
     (back-to-indentation)
     (if com (vip-execute-com 'vip-next-line-at-bol val com))))
 
@@ -1271,7 +1272,7 @@ beginning of buffer, stop and signal error."
   (interactive "P")
   (let ((val (vip-p-val arg)) (com (vip-getCom arg)))
     (if com (move-marker vip-com-point (point)))
-    (next-line (- val))
+    (with-no-warnings (next-line (- val)))
     (setq this-command 'previous-line)
     (if com (vip-execute-com 'vip-previous-line val com))))
 
@@ -1280,7 +1281,7 @@ beginning of buffer, stop and signal error."
   (interactive "P")
   (let ((val (vip-p-val arg)) (com (vip-getCom arg)))
     (if com (move-marker vip-com-point (point)))
-    (next-line (- val))
+    (with-no-warnings (next-line (- val)))
     (back-to-indentation)
     (if com (vip-execute-com 'vip-previous-line val com))))
 
@@ -1322,7 +1323,7 @@ after search."
             ;; forward search begins here
             (if (eolp) (error "") (point))
             ;; forward search ends here
-            (progn (next-line 1) (beginning-of-line) (point)))
+            (progn (with-no-warnings (next-line 1)) (beginning-of-line) (point)))
          (narrow-to-region
           ;; backward search begins from here
           (if (bolp) (error "") (point))
@@ -1342,7 +1343,7 @@ after search."
 (defun vip-find-char-forward (arg)
   "Find char on the line.  If called interactively read the char to find
 from the terminal, and if called from vip-repeat, the char last used is
-used.  This behaviour is controlled by the sign of prefix numeric value."
+used.  This behavior is controlled by the sign of prefix numeric value."
   (interactive "P")
   (let ((val (vip-p-val arg)) (com (vip-getcom arg)))
     (if (> val 0)
@@ -1802,7 +1803,7 @@ STRING.  Search will be forward if FORWARD, otherwise backward."
     (setq vip-use-register nil)
     (if (vip-end-with-a-newline-p text)
        (progn
-         (next-line 1)
+         (with-no-warnings (next-line 1))
          (beginning-of-line))
       (if (and (not (eolp)) (not (eobp))) (forward-char)))
     (setq vip-d-com (list 'vip-put-back val nil vip-use-register))
@@ -2177,7 +2178,7 @@ a token has type \(command, address, end-mark\) and value."
                 (cond ((string= ex-token-type "plus") "add-number")
                       ((string= ex-token-type "minus") "sub-number")
                       (t "abs-number")))
-          (setq ex-token (string-to-int (buffer-substring (point) (mark)))))
+          (setq ex-token (string-to-number (buffer-substring (point) (mark)))))
          ((looking-at "\\$")
           (forward-char 1)
           (setq ex-token-type "end"))
@@ -2292,7 +2293,7 @@ a token has type \(command, address, end-mark\) and value."
                             (setq cont nil))
                            (t (error "Extra character at end of a command")))))))
            ((string= ex-token-type "non-command")
-            (error (format "%s: Not an editor command" ex-token)))
+            (error "%s: Not an editor command" ex-token))
            ((string= ex-token-type "whole")
             (setq ex-addresses
                   (cons (point-max) (cons (point-min) ex-addresses))))
@@ -2471,7 +2472,7 @@ a token has type \(command, address, end-mark\) and value."
        (progn
          (set-mark (point))
          (re-search-forward "[0-9][0-9]*")
-         (setq ex-count (string-to-int (buffer-substring (point) (mark))))
+         (setq ex-count (string-to-number (buffer-substring (point) (mark))))
          (skip-chars-forward " \t")))
     (if (looking-at "[pl#]")
        (progn
@@ -2496,7 +2497,7 @@ a token has type \(command, address, end-mark\) and value."
        (progn
          (set-mark (point))
          (re-search-forward "[0-9][0-9]*")
-         (setq ex-count (string-to-int (buffer-substring (point) (mark))))
+         (setq ex-count (string-to-number (buffer-substring (point) (mark))))
          (skip-chars-forward " \t")))
     (if (looking-at "[pl#]")
        (progn
@@ -2830,7 +2831,8 @@ a token has type \(command, address, end-mark\) and value."
       (skip-chars-forward " \t")
       (if (looking-at "[\n|]") (error "Missing rhs"))
       (set-mark (point))
-      (end-of-buffer)
+      (with-no-warnings
+       (end-of-buffer))
       (backward-char 1)
       (setq string (buffer-substring (mark) (point))))
     (if (not (lookup-key ex-map char))
@@ -2881,7 +2883,7 @@ a token has type \(command, address, end-mark\) and value."
   (let ((point (if (null ex-addresses) (point) (car ex-addresses)))
        (variant nil) command file)
     (goto-char point)
-    (if (not (= point 0)) (next-line 1))
+    (if (not (= point 0)) (with-no-warnings (next-line 1)))
     (beginning-of-line)
     (save-window-excursion
       (set-buffer " *ex-working-space*")
@@ -2900,7 +2902,8 @@ a token has type \(command, address, end-mark\) and value."
        (setq file (buffer-substring (point) (mark)))))
       (if variant
          (shell-command command t)
-       (insert-file file))))
+       (with-no-warnings
+         (insert-file file)))))
 
 (defun ex-set ()
   (eval (list 'setq
@@ -3072,5 +3075,5 @@ vip-s-string"
 
 (provide 'vip)
 
-;;; arch-tag: bff623ef-48f7-41d4-9aa3-2e840c9ab415
+;; arch-tag: bff623ef-48f7-41d4-9aa3-2e840c9ab415
 ;;; vip.el ends here