diff lisp/viper/viper-ex.el @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents bfd6434d15b3
children acd284d43ca1
line wrap: on
line diff
--- a/lisp/viper/viper-ex.el	Mon Aug 13 09:54:24 2007 +0200
+++ b/lisp/viper/viper-ex.el	Mon Aug 13 09:55:28 2007 +0200
@@ -326,98 +326,100 @@
     (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
     (set-buffer viper-ex-work-buf)
     (skip-chars-forward " \t|")
-    (cond ((looking-at "#")
-	   (setq ex-token-type 'command)
-	   (setq ex-token (char-to-string (following-char)))
-	   (forward-char 1))
-	  ((looking-at "[a-z]") (viper-get-ex-com-subr))
-	  ((looking-at "\\.")
-	   (forward-char 1)
-	   (setq ex-token-type 'dot))
-	  ((looking-at "[0-9]")
-	   (set-mark (point))
-	   (re-search-forward "[0-9]*")
-	   (setq ex-token-type
-		 (cond ((eq ex-token-type 'plus) 'add-number)
-		       ((eq ex-token-type 'minus) 'sub-number)
-		       (t 'abs-number)))
-	   (setq ex-token (string-to-int (buffer-substring (point) (mark t)))))
-	  ((looking-at "\\$")
-	   (forward-char 1)
-	   (setq ex-token-type 'end))
-	  ((looking-at "%")
-	   (forward-char 1)
-	   (setq ex-token-type 'whole))
-	  ((looking-at "+")
-	   (cond ((or (looking-at "+[-+]") (looking-at "+[\n|]"))
-		  (forward-char 1)
-		  (insert "1")
-		  (backward-char 1)
-		  (setq ex-token-type 'plus))
-		 ((looking-at "+[0-9]")
-		  (forward-char 1)
+    (let ((case-fold-search t))
+      (cond ((looking-at "#")
+	     (setq ex-token-type 'command)
+	     (setq ex-token (char-to-string (following-char)))
+	     (forward-char 1))
+	    ((looking-at "[a-z]") (viper-get-ex-com-subr))
+	    ((looking-at "\\.")
+	     (forward-char 1)
+	     (setq ex-token-type 'dot))
+	    ((looking-at "[0-9]")
+	     (set-mark (point))
+	     (re-search-forward "[0-9]*")
+	     (setq ex-token-type
+		   (cond ((eq ex-token-type 'plus) 'add-number)
+			 ((eq ex-token-type 'minus) 'sub-number)
+			 (t 'abs-number)))
+	     (setq ex-token
+		   (string-to-int (buffer-substring (point) (mark t)))))
+	    ((looking-at "\\$")
+	     (forward-char 1)
+	     (setq ex-token-type 'end))
+	    ((looking-at "%")
+	     (forward-char 1)
+	     (setq ex-token-type 'whole))
+	    ((looking-at "+")
+	     (cond ((or (looking-at "+[-+]") (looking-at "+[\n|]"))
+		    (forward-char 1)
+		    (insert "1")
+		    (backward-char 1)
 		  (setq ex-token-type 'plus))
-		 (t
-		  (error viper-BadAddress))))
-	  ((looking-at "-")
-	   (cond ((or (looking-at "-[-+]") (looking-at "-[\n|]"))
-		  (forward-char 1)
-		  (insert "1")
-		  (backward-char 1)
-		  (setq ex-token-type 'minus))
-		 ((looking-at "-[0-9]")
-		  (forward-char 1)
-		  (setq ex-token-type 'minus))
-		 (t
-		  (error viper-BadAddress))))
-	  ((looking-at "/")
-	   (forward-char 1)
-	   (set-mark (point))
-	   (let ((cont t))
-	     (while (and (not (eolp)) cont)
-	       ;;(re-search-forward "[^/]*/")
-	       (re-search-forward "[^/]*\\(/\\|\n\\)")
-	       (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"))
-		   (setq cont nil))))
-	   (backward-char 1)
-	   (setq ex-token (buffer-substring (point) (mark t)))
-	   (if (looking-at "/") (forward-char 1))
-	   (setq ex-token-type 'search-forward))
-	  ((looking-at "\\?")
-	   (forward-char 1)
-	   (set-mark (point))
-	   (let ((cont t))
-	     (while (and (not (eolp)) cont)
-	       ;;(re-search-forward "[^\\?]*\\?")
-	       (re-search-forward "[^\\?]*\\(\\?\\|\n\\)")
-	       (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?"))
-		   (setq cont nil))
-	       (backward-char 1)
-	       (if (not (looking-at "\n")) (forward-char 1))))
-	   (setq ex-token-type 'search-backward)
-	   (setq ex-token (buffer-substring (1- (point)) (mark t))))
-	  ((looking-at ",")
-	   (forward-char 1)
-	   (setq ex-token-type 'comma))
-	  ((looking-at ";")
-	   (forward-char 1)
-	   (setq ex-token-type 'semi-colon))
-	  ((looking-at "[!=><&~]")
-	   (setq ex-token-type 'command)
-	   (setq ex-token (char-to-string (following-char)))
-	   (forward-char 1))
-	  ((looking-at "'")
-	   (setq ex-token-type 'goto-mark)
-	   (forward-char 1)
-	   (cond ((looking-at "'") (setq ex-token nil))
-		 ((looking-at "[a-z]") (setq ex-token (following-char)))
-		 (t (error "Marks are ' and a-z")))
-	   (forward-char 1))
-	  ((looking-at "\n")
-	   (setq ex-token-type 'end-mark)
-	   (setq ex-token "goto"))
-	  (t
-	   (error viper-BadExCommand)))))
+		   ((looking-at "+[0-9]")
+		    (forward-char 1)
+		    (setq ex-token-type 'plus))
+		   (t
+		    (error viper-BadAddress))))
+	    ((looking-at "-")
+	     (cond ((or (looking-at "-[-+]") (looking-at "-[\n|]"))
+		    (forward-char 1)
+		    (insert "1")
+		    (backward-char 1)
+		    (setq ex-token-type 'minus))
+		   ((looking-at "-[0-9]")
+		    (forward-char 1)
+		    (setq ex-token-type 'minus))
+		   (t
+		    (error viper-BadAddress))))
+	    ((looking-at "/")
+	     (forward-char 1)
+	     (set-mark (point))
+	     (let ((cont t))
+	       (while (and (not (eolp)) cont)
+		 ;;(re-search-forward "[^/]*/")
+		 (re-search-forward "[^/]*\\(/\\|\n\\)")
+		 (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"))
+		     (setq cont nil))))
+	     (backward-char 1)
+	     (setq ex-token (buffer-substring (point) (mark t)))
+	     (if (looking-at "/") (forward-char 1))
+	     (setq ex-token-type 'search-forward))
+	    ((looking-at "\\?")
+	     (forward-char 1)
+	     (set-mark (point))
+	     (let ((cont t))
+	       (while (and (not (eolp)) cont)
+		 ;;(re-search-forward "[^\\?]*\\?")
+		 (re-search-forward "[^\\?]*\\(\\?\\|\n\\)")
+		 (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?"))
+		     (setq cont nil))
+		 (backward-char 1)
+		 (if (not (looking-at "\n")) (forward-char 1))))
+	     (setq ex-token-type 'search-backward)
+	     (setq ex-token (buffer-substring (1- (point)) (mark t))))
+	    ((looking-at ",")
+	     (forward-char 1)
+	     (setq ex-token-type 'comma))
+	    ((looking-at ";")
+	     (forward-char 1)
+	     (setq ex-token-type 'semi-colon))
+	    ((looking-at "[!=><&~]")
+	     (setq ex-token-type 'command)
+	     (setq ex-token (char-to-string (following-char)))
+	     (forward-char 1))
+	    ((looking-at "'")
+	     (setq ex-token-type 'goto-mark)
+	     (forward-char 1)
+	     (cond ((looking-at "'") (setq ex-token nil))
+		   ((looking-at "[a-z]") (setq ex-token (following-char)))
+		   (t (error "Marks are ' and a-z")))
+	     (forward-char 1))
+	    ((looking-at "\n")
+	     (setq ex-token-type 'end-mark)
+	     (setq ex-token "goto"))
+	    (t
+	     (error viper-BadExCommand))))))
 
 ;; Reads Ex command. Tries to determine if it has to exit because command
 ;; is complete or invalid. If not, keeps reading command.