changeset 27227:10ee0084db53

Assorted cleanups for compiler warnings, doc strings, `array-' prefix for symbols.
author Dave Love <fx@gnu.org>
date Thu, 06 Jan 2000 23:12:02 +0000
parents 44dc06740e6c
children b4676dda4b53
files lisp/array.el
diffstat 1 files changed, 234 insertions(+), 219 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/array.el	Thu Jan 06 16:37:03 2000 +0000
+++ b/lisp/array.el	Thu Jan 06 23:12:02 2000 +0000
@@ -1,6 +1,6 @@
 ;;; array.el --- array editing commands for Gnu Emacs
 
-;; Copyright (C) 1987 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2000 Free Software Foundation, Inc.
 
 ;; Author David M. Brown
 ;; Maintainer: FSF
@@ -41,58 +41,74 @@
 
 ;;; Code:
 
+(eval-when-compile
+  (defvar array-max-column)
+  (defvar array-columns-per-line)
+  (defvar array-buffer-column)
+  (defvar array-line-length)
+  (defvar array-buffer-line)
+  (defvar array-lines-per-row)
+  (defvar array-max-row)
+  (defvar array-field-width)
+  (defvar array-row)
+  (defvar array-column)
+  (defvar array-rows-numbered)
+  (defvar array-copy-string)
+  (defvar array-init-field)
+  (defvar array-respect-tabs))
+
 ;;; Internal information functions.
   
 (defun array-cursor-in-array-range ()
-  "Returns t if the cursor is in a valid array cell.
+  "Return t if the cursor is in a valid array cell.
 Its ok to be on a row number line."
-  (let ((columns-last-line (% max-column columns-per-line)))
-    ;; Requires buffer-line and buffer-column to be current.
+  (let ((columns-last-line (% array-max-column array-columns-per-line)))
+    ;; Requires array-buffer-line and array-buffer-column to be current.
     (not (or
 	  ;; The cursor is too far to the right.
-	  (>= buffer-column line-length)
+	  (>= array-buffer-column array-line-length)
 	  ;; The cursor is below the last row.
-	  (>= buffer-line (* lines-per-row max-row))
+	  (>= array-buffer-line (* array-lines-per-row array-max-row))
 	  ;; The cursor is on the last line of the row, the line is smaller
 	  ;;  than the others, and the cursor is after the last array column
 	  ;;  on the line.
-	  (and (zerop (% (1+ buffer-line) lines-per-row))
+	  (and (zerop (% (1+ array-buffer-line) array-lines-per-row))
 	       (not (zerop columns-last-line))
-	       (>= buffer-column (* columns-last-line field-width)))))))
+	       (>= array-buffer-column (* columns-last-line array-field-width)))))))
 
 (defun array-current-row ()
   "Return the array row of the field in which the cursor is located."
-  ;; Requires buffer-line and buffer-column to be current.
+  ;; Requires array-buffer-line and array-buffer-column to be current.
   (and (array-cursor-in-array-range)
-       (1+ (floor buffer-line lines-per-row))))
+       (1+ (floor array-buffer-line array-lines-per-row))))
 
 (defun array-current-column ()
   "Return the array column of the field in which the cursor is located."
-  ;; Requires buffer-line and buffer-column to be current.
+  ;; Requires array-buffer-line and array-buffer-column to be current.
   (and (array-cursor-in-array-range)
        ;; It's not okay to be on a row number line.
-       (not (and rows-numbered
-		 (zerop (% buffer-line lines-per-row))))
+       (not (and array-rows-numbered
+		 (zerop (% array-buffer-line array-lines-per-row))))
        (+
 	;; Array columns due to line differences.
-	(* columns-per-line
-	   (if rows-numbered
-	       (1- (% buffer-line lines-per-row))
-	     (% buffer-line lines-per-row)))
+	(* array-columns-per-line
+	   (if array-rows-numbered
+	       (1- (% array-buffer-line array-lines-per-row))
+	     (% array-buffer-line array-lines-per-row)))
 	;; Array columns on the current line.
-	(1+ (floor buffer-column field-width)))))
+	(1+ (floor array-buffer-column array-field-width)))))
 
 (defun array-update-array-position (&optional a-row a-column)
-  "Set `array-row' and `array-column' to their current values or
-to the optional arguments A-ROW and A-COLUMN."
-  ;; Requires that buffer-line and buffer-column be current.
+  "Set `array-row' and `array-column' to their current values.
+Set them to the optional arguments A-ROW and A-COLUMN if those are supplied."
+  ;; Requires that array-buffer-line and array-buffer-column be current.
   (setq array-row (or a-row (array-current-row))
 	array-column (or a-column (array-current-column))))
 
 (defun array-update-buffer-position ()
-  "Set buffer-line and buffer-column to their current values."
-  (setq buffer-line (current-line)
-	buffer-column (current-column)))
+  "Set array-buffer-line and array-buffer-column to their current values."
+  (setq array-buffer-line (current-line)
+	array-buffer-column (current-column)))
 
 
 
@@ -101,9 +117,9 @@
 (defun array-what-position ()
   "Display the row and column in which the cursor is positioned."
   (interactive)
-  (let ((buffer-line (current-line))
-	(buffer-column (current-column)))
-    (message "Array row: %s  Array column: %s" 
+  (let ((array-buffer-line (current-line))
+	(array-buffer-column (current-column)))
+    (message "Array row: %s  Array column: %s"
 	     (prin1-to-string (array-current-row))
 	     (prin1-to-string (array-current-column)))))
 
@@ -116,19 +132,19 @@
       (terpri)
       (princ (format " Buffer:             %s\n\n" buf))
       (princ (format "  max-row:           %s\n"
-		     (prin1-to-string max-row)))
+		     (prin1-to-string array-max-row)))
       (princ (format "  max-column:        %s\n"
-		     (prin1-to-string max-column)))
+		     (prin1-to-string array-max-column)))
       (princ (format "  columns-per-line:  %s\n"
-		     (prin1-to-string columns-per-line)))
+		     (prin1-to-string array-columns-per-line)))
       (princ (format "  field-width:       %s\n"
-		     (prin1-to-string field-width)))
+		     (prin1-to-string array-field-width)))
       (princ (format "  rows-numbered:     %s\n"
-		     (prin1-to-string rows-numbered)))
+		     (prin1-to-string array-rows-numbered)))
       (princ (format "  lines-per-row:     %s\n"
-		     (prin1-to-string lines-per-row)))
+		     (prin1-to-string array-lines-per-row)))
       (princ (format "  line-length:       %s\n"
-		     (prin1-to-string line-length))))))
+		     (prin1-to-string array-line-length))))))
 
 
 
@@ -137,8 +153,8 @@
 (defun array-beginning-of-field (&optional go-there)
    "Return the column of the beginning of the current field.
 Optional argument GO-THERE, if non-nil, means go there too."
-   ;; Requires that buffer-column be current.
-   (let ((goal-column (- buffer-column (% buffer-column field-width))))
+   ;; Requires that array-buffer-column be current.
+   (let ((goal-column (- array-buffer-column (% array-buffer-column array-field-width))))
      (if go-there
 	 (move-to-column-untabify goal-column)
        goal-column)))
@@ -146,20 +162,20 @@
 (defun array-end-of-field (&optional go-there)
   "Return the column of the end of the current array field.
 If optional argument GO-THERE is non-nil, go there too."
-  ;; Requires that buffer-column be current.
-  (let ((goal-column (+ (- buffer-column (% buffer-column field-width))
-			field-width)))
+  ;; Requires that array-buffer-column be current.
+  (let ((goal-column (+ (- array-buffer-column (% array-buffer-column array-field-width))
+			array-field-width)))
     (if go-there
 	(move-to-column-untabify goal-column)
       goal-column)))
 
 (defun array-move-to-cell (a-row a-column)
-  "Move to array row A-ROW and array column A-COLUMN.  
+  "Move to array row A-ROW and array column A-COLUMN.
 Leave point at the beginning of the field and return the new buffer column."
-  (let ((goal-line (+ (* lines-per-row (1- a-row))
-		      (if rows-numbered 1 0)
-		      (floor (1- a-column) columns-per-line)))
-	(goal-column (* field-width (% (1- a-column) columns-per-line))))
+  (let ((goal-line (+ (* array-lines-per-row (1- a-row))
+		      (if array-rows-numbered 1 0)
+		      (floor (1- a-column) array-columns-per-line)))
+	(goal-column (* array-field-width (% (1- a-column) array-columns-per-line))))
     (goto-char (point-min))
     (forward-line goal-line)
     (move-to-column-untabify goal-column)))
@@ -167,23 +183,23 @@
 (defun array-move-to-row (a-row)
   "Move to array row A-ROW preserving the current array column.
 Leave point at the beginning of the field and return the new array row."
-  ;; Requires that buffer-line and buffer-column be current.
-  (let ((goal-line (+ (* lines-per-row (1- a-row))
-		      (% buffer-line lines-per-row)))
-	(goal-column (- buffer-column (% buffer-column field-width))))
-    (forward-line (- goal-line buffer-line))
+  ;; Requires that array-buffer-line and array-buffer-column be current.
+  (let ((goal-line (+ (* array-lines-per-row (1- a-row))
+		      (% array-buffer-line array-lines-per-row)))
+	(goal-column (- array-buffer-column (% array-buffer-column array-field-width))))
+    (forward-line (- goal-line array-buffer-line))
     (move-to-column-untabify goal-column)
     a-row))
 
 (defun array-move-to-column (a-column)
   "Move to array column A-COLUMN preserving the current array row.
 Leave point at the beginning of the field and return the new array column."
-  ;; Requires that buffer-line and buffer-column be current.
-  (let ((goal-line (+ (- buffer-line (% buffer-line lines-per-row))
-		      (if rows-numbered 1 0)
-		      (floor (1- a-column) columns-per-line)))
-	(goal-column (* field-width (% (1- a-column) columns-per-line))))
-    (forward-line (- goal-line buffer-line))
+  ;; Requires that array-buffer-line and array-buffer-column be current.
+  (let ((goal-line (+ (- array-buffer-line (% array-buffer-line array-lines-per-row))
+		      (if array-rows-numbered 1 0)
+		      (floor (1- a-column) array-columns-per-line)))
+	(goal-column (* array-field-width (% (1- a-column) array-columns-per-line))))
+    (forward-line (- goal-line array-buffer-line))
     (move-to-column-untabify goal-column)
     a-column))
 
@@ -191,17 +207,17 @@
   "Move one array row in direction SIGN (1 or -1).
 Leave point at the beginning of the field and return the new array row.
 If requested to move beyond the array bounds, signal an error."
-  ;; Requires that buffer-line and buffer-column be current.
+  ;; Requires that array-buffer-line and array-buffer-column be current.
   (let ((goal-column (array-beginning-of-field))
 	(array-row (or (array-current-row)
-		       (error "Cursor is not in a valid array cell."))))
-    (cond ((and (= array-row max-row) (= sign 1))
-	   (error "End of array."))
+		       (error "Cursor is not in a valid array cell"))))
+    (cond ((and (= array-row array-max-row) (= sign 1))
+	   (error "End of array"))
 	  ((and (= array-row 1) (= sign -1))
-	   (error "Beginning of array."))
+	   (error "Beginning of array"))
 	  (t
 	   (progn
-	     (forward-line (* sign lines-per-row))
+	     (forward-line (* sign array-lines-per-row))
 	     (move-to-column-untabify goal-column)
 	     (+ array-row sign))))))
 
@@ -209,34 +225,34 @@
   "Move one array column in direction SIGN (1 or -1).
 Leave point at the beginning of the field and return the new array column.
 If requested to move beyond the array bounds, signal an error."
-  ;; Requires that buffer-line and buffer-column be current.
+  ;; Requires that array-buffer-line and array-buffer-column be current.
   (let ((array-column (or (array-current-column)
-		      (error "Cursor is not in a valid array cell."))))
-    (cond ((and (= array-column max-column) (= sign 1))
-	   (error "End of array."))
+		      (error "Cursor is not in a valid array cell"))))
+    (cond ((and (= array-column array-max-column) (= sign 1))
+	   (error "End of array"))
 	  ((and (= array-column 1) (= sign -1))
-	   (error "Beginning of array."))
+	   (error "Beginning of array"))
 	  (t
-	   (cond 
+	   (cond
 	    ;; Going backward from first column on the line.
-	    ((and (= sign -1) (= 1 (% array-column columns-per-line)))
+	    ((and (= sign -1) (= 1 (% array-column array-columns-per-line)))
 	     (forward-line -1)
 	     (move-to-column-untabify
-	      (* field-width (1- columns-per-line))))
+	      (* array-field-width (1- array-columns-per-line))))
 	    ;; Going forward from last column on the line.
-	    ((and (= sign 1) (zerop (% array-column columns-per-line)))
+	    ((and (= sign 1) (zerop (% array-column array-columns-per-line)))
 	     (forward-line 1))
 	    ;; Somewhere in the middle of the line.
 	    (t
 	     (move-to-column-untabify (+ (array-beginning-of-field)
-					 (* field-width sign)))))
+					 (* array-field-width sign)))))
 	   (+ array-column sign)))))
 
 (defun array-normalize-cursor ()
-  "Move the cursor to the first non-whitespace character in the field and,
-if necessary, scroll horizontally to keep the cursor in view."
+  "Move the cursor to the first non-whitespace character in the field.
+If necessary, scroll horizontally to keep the cursor in view."
   ;; Assumes point is at the beginning of the field.
-  (let ((buffer-column (current-column)))
+  (let ((array-buffer-column (current-column)))
     (skip-chars-forward " \t"
 			(1- (save-excursion (array-end-of-field t) (point))))
     (array-maybe-scroll-horizontally)))
@@ -244,21 +260,21 @@
 (defun array-maybe-scroll-horizontally ()
   "If necessary, scroll horizontally to keep the cursor in view."
   ;; This is only called from array-normalize-cursor so
-  ;;  buffer-column will always be current.
+  ;;  array-buffer-column will always be current.
   (let ((w-hscroll (window-hscroll))
 	(w-width (window-width)))
     (cond
-     ((and (>= buffer-column w-hscroll)
-	   (<= buffer-column (+ w-hscroll w-width)))
+     ((and (>= array-buffer-column w-hscroll)
+	   (<= array-buffer-column (+ w-hscroll w-width)))
       ;; It's already visible.  Do nothing.
       nil)
-     ((> buffer-column (+ w-hscroll w-width))
+     ((> array-buffer-column (+ w-hscroll w-width))
       ;; It's to the right.  Scroll left.
-      (scroll-left (- (- buffer-column w-hscroll)
+      (scroll-left (- (- array-buffer-column w-hscroll)
 		      (/ w-width 2))))
      (t
       ;; It's to the left.  Scroll right.
-      (scroll-right (+ (- w-hscroll buffer-column)
+      (scroll-right (+ (- w-hscroll array-buffer-column)
 		       (/ w-width 2)))))))
 
 
@@ -269,15 +285,15 @@
   "Move down one array row, staying in the current array column.
 If optional ARG is given, move down ARG array rows."
   (interactive "p")
-  (let ((buffer-line (current-line))
-	(buffer-column (current-column)))
+  (let ((array-buffer-line (current-line))
+	(array-buffer-column (current-column)))
     (if (= (abs arg) 1)
 	(array-move-one-row arg)
       (array-move-to-row
        (limit-index (+ (or (array-current-row)
-			   (error "Cursor is not in an array cell."))
+			   (error "Cursor is not in an array cell"))
 		       arg)
-		    max-row))))
+		    array-max-row))))
   (array-normalize-cursor))
 
 (defun array-previous-row (&optional arg)
@@ -291,15 +307,15 @@
 If optional ARG is given, move forward ARG array columns.
 If necessary, keep the cursor in the window by scrolling right or left."
   (interactive "p")
-  (let ((buffer-line (current-line))
-	(buffer-column (current-column)))
+  (let ((array-buffer-line (current-line))
+	(array-buffer-column (current-column)))
     (if (= (abs arg) 1)
 	(array-move-one-column arg)
       (array-move-to-column
        (limit-index (+ (or (array-current-column)
-			   (error "Cursor is not in an array cell."))
+			   (error "Cursor is not in an array cell"))
 		       arg)
-		    max-column))))
+		    array-max-column))))
   (array-normalize-cursor))
 
 (defun array-backward-column (&optional arg)
@@ -313,8 +329,8 @@
   "Go to array row A-ROW and array column A-COLUMN."
   (interactive "nArray row: \nnArray column: ")
   (array-move-to-cell
-   (limit-index a-row max-row)
-   (limit-index a-column max-column))
+   (limit-index a-row array-max-row)
+   (limit-index a-column array-max-column))
   (array-normalize-cursor))
 
 
@@ -323,7 +339,7 @@
 
 (defun array-field-string ()
   "Return the field string at the current cursor location."
-  ;; Requires that buffer-column be current.
+  ;; Requires that array-buffer-column be current.
   (buffer-substring
    (save-excursion (array-beginning-of-field t) (point))
    (save-excursion (array-end-of-field t) (point))))
@@ -332,32 +348,32 @@
   "Copy the current field into one array row in direction SIGN (1 or -1).
 Leave point at the beginning of the field and return the new array row.
 If requested to move beyond the array bounds, signal an error."
-  ;; Requires that buffer-line, buffer-column, and copy-string be current.
+  ;; Requires that array-buffer-line, array-buffer-column, and array-copy-string be current.
   (let ((a-row (array-move-one-row sign)))
     (let ((inhibit-quit t))
       (delete-region (point) (save-excursion (array-end-of-field t) (point)))
-      (insert copy-string))
-    (move-to-column buffer-column)
+      (insert array-copy-string))
+    (move-to-column array-buffer-column)
     a-row))
 
 (defun array-copy-once-horizontally (sign)
   "Copy the current field into one array column in direction SIGN (1 or -1).
 Leave point at the beginning of the field and return the new array column.
 If requested to move beyond the array bounds, signal an error."
-  ;; Requires that buffer-line, buffer-column, and copy-string be current.
+  ;; Requires that array-buffer-line, array-buffer-column, and array-copy-string be current.
   (let ((a-column (array-move-one-column sign)))
     (array-update-buffer-position)
     (let ((inhibit-quit t))
       (delete-region (point) (save-excursion (array-end-of-field t) (point)))
-      (insert copy-string))
-    (move-to-column buffer-column)
+      (insert array-copy-string))
+    (move-to-column array-buffer-column)
     a-column))
 
 (defun array-copy-to-row (a-row)
   "Copy the current field vertically into every cell up to and including A-ROW.
 Leave point at the beginning of the field."
-  ;; Requires that buffer-line, buffer-column, array-row, and
-  ;;  copy-string be current.
+  ;; Requires that array-buffer-line, array-buffer-column, array-row, and
+  ;;  array-copy-string be current.
   (let* ((num (- a-row array-row))
 	 (count (abs num))
 	 (sign (if (zerop count) () (/ num count))))
@@ -366,15 +382,15 @@
       (array-update-buffer-position)
       (let ((inhibit-quit t))
 	(delete-region (point) (save-excursion (array-end-of-field t) (point)))
-	(insert copy-string))
-      (move-to-column buffer-column)
+	(insert array-copy-string))
+      (move-to-column array-buffer-column)
       (setq count (1- count)))))
 	
 (defun array-copy-to-column (a-column)
-  "Copy the current field horizontally into every cell up to and including
-A-COLUMN.  Leave point at the beginning of the field."
-  ;; Requires that buffer-line, buffer-column, array-column, and
-  ;;  copy-string be current.
+  "Copy current field horizontally into every cell up to and including A-COLUMN.
+Leave point at the beginning of the field."
+  ;; Requires that array-buffer-line, array-buffer-column, array-column, and
+  ;;  array-copy-string be current.
   (let* ((num (- a-column array-column))
 	 (count (abs num))
 	 (sign (if (zerop count) () (/ num count))))
@@ -383,19 +399,19 @@
       (array-update-buffer-position)
       (let ((inhibit-quit t))
 	(delete-region (point) (save-excursion (array-end-of-field t) (point)))
-	(insert copy-string))
-      (move-to-column buffer-column)
+	(insert array-copy-string))
+      (move-to-column array-buffer-column)
       (setq count (1- count)))))
 
 (defun array-copy-to-cell (a-row a-column)
   "Copy the current field into the cell at A-ROW, A-COLUMN.
 Leave point at the beginning of the field."
-  ;; Requires that copy-string be current.
+  ;; Requires that array-copy-string be current.
   (array-move-to-cell a-row a-column)
   (array-update-buffer-position)
   (delete-region (point) (save-excursion (array-end-of-field t) (point)))
-  (insert copy-string)
-  (move-to-column buffer-column))
+  (insert array-copy-string)
+  (move-to-column array-buffer-column))
 
 
 
@@ -405,15 +421,15 @@
   "Copy the current field one array row down.
 If optional ARG is given, copy down through ARG array rows."
   (interactive "p")
-  (let* ((buffer-line (current-line))
-	 (buffer-column (current-column))
+  (let* ((array-buffer-line (current-line))
+	 (array-buffer-column (current-column))
 	 (array-row (or (array-current-row)
-			   (error "Cursor is not in a valid array cell.")))
-	 (copy-string (array-field-string)))
+			   (error "Cursor is not in a valid array cell")))
+	 (array-copy-string (array-field-string)))
     (if (= (abs arg) 1)
 	(array-copy-once-vertically arg)
       (array-copy-to-row
-       (limit-index (+ array-row arg) max-row))))
+       (limit-index (+ array-row arg) array-max-row))))
   (array-normalize-cursor))
 
 (defun array-copy-up (&optional arg)
@@ -426,15 +442,15 @@
   "Copy the current field one array column to the right.
 If optional ARG is given, copy through ARG array columns to the right."
   (interactive "p")
-  (let* ((buffer-line (current-line))
-	 (buffer-column (current-column))
+  (let* ((array-buffer-line (current-line))
+	 (array-buffer-column (current-column))
 	 (array-column (or (array-current-column)
-			   (error "Cursor is not in a valid array cell.")))
-	 (copy-string (array-field-string)))
+			   (error "Cursor is not in a valid array cell")))
+	 (array-copy-string (array-field-string)))
     (if (= (abs arg) 1)
 	(array-copy-once-horizontally arg)
       (array-copy-to-column
-       (limit-index (+ array-column arg) max-column))))
+       (limit-index (+ array-column arg) array-max-column))))
   (array-normalize-cursor))
 
 (defun array-copy-backward (&optional arg)
@@ -450,18 +466,18 @@
   (array-update-buffer-position)
   (array-update-array-position)
   (if (not array-column)
-      (error "Cursor is not in a valid array cell."))
+      (error "Cursor is not in a valid array cell"))
   (message "Working...")
   (let ((this-row 0))
-    (while (< this-row max-row)
+    (while (< this-row array-max-row)
       (setq this-row (1+ this-row))
       (array-move-to-cell this-row array-column)
       (array-update-buffer-position)
-      (let ((copy-string (array-field-string)))
+      (let ((array-copy-string (array-field-string)))
 	(if (= (abs arg) 1)
 	    (array-copy-once-horizontally arg)
 	  (array-copy-to-column
-	   (limit-index (+ array-column arg) max-column))))))
+	   (limit-index (+ array-column arg) array-max-column))))))
   (message "Working...done")
   (array-move-to-row array-row)
   (array-normalize-cursor))
@@ -479,22 +495,22 @@
   (array-update-buffer-position)
   (array-update-array-position)
   (if (not array-row)
-      (error "Cursor is not in a valid array cell."))
+      (error "Cursor is not in a valid array cell"))
   (cond
    ((and (= array-row 1) (= arg -1))
-    (error "Beginning of array."))
-   ((and (= array-row max-row) (= arg 1))
-    (error "End of array."))
+    (error "Beginning of array"))
+   ((and (= array-row array-max-row) (= arg 1))
+    (error "End of array"))
    (t
-    (let* ((copy-string
+    (let* ((array-copy-string
 	    (buffer-substring
 	     (save-excursion (array-move-to-cell array-row 1)
 			     (point))
-	     (save-excursion (array-move-to-cell array-row max-column)
+	     (save-excursion (array-move-to-cell array-row array-max-column)
 			     (forward-line 1)
 			     (point))))
 	   (this-row array-row)
-	   (goal-row (limit-index (+ this-row arg) max-row))
+	   (goal-row (limit-index (+ this-row arg) array-max-row))
 	   (num (- goal-row this-row))
 	   (count (abs num))
 	   (sign (if (not (zerop count)) (/ num count))))
@@ -504,10 +520,10 @@
 	(let ((inhibit-quit t))
 	  (delete-region (point)
 			 (save-excursion
-			   (array-move-to-cell this-row max-column)
+			   (array-move-to-cell this-row array-max-column)
 			   (forward-line 1)
 			   (point)))
-	  (insert copy-string))
+	  (insert array-copy-string))
 	(setq count (1- count)))
       (array-move-to-cell goal-row (or array-column 1)))))
   (array-normalize-cursor))
@@ -524,28 +540,28 @@
   ;; Bind arguments.
   (array-update-buffer-position)
   (let ((p-row (or (array-current-row)
-		   (error "Cursor is not in a valid array cell.")))
+		   (error "Cursor is not in a valid array cell")))
 	(p-column (or (array-current-column)
-		      (error "Cursor is not in a valid array cell.")))
+		      (error "Cursor is not in a valid array cell")))
 	(m-row
 	 (save-excursion
 	   (exchange-point-and-mark)
 	   (array-update-buffer-position)
 	   (or (array-current-row)
-	       (error "Mark is not in a valid array cell."))))
-	(m-column 
+	       (error "Mark is not in a valid array cell"))))
+	(m-column
 	 (save-excursion
 	   (exchange-point-and-mark)
 	   (array-update-buffer-position)
 	   (or (array-current-column)
-	       (error "Mark is not in a valid array cell.")))))
+	       (error "Mark is not in a valid array cell")))))
     (message "Working...")
     (let ((top-row (min m-row p-row))
 	  (bottom-row (max m-row p-row))
 	  (left-column (min m-column p-column))
 	  (right-column (max m-column p-column)))
       ;; Do the first row.
-      (let ((copy-string
+      (let ((array-copy-string
 	     (save-excursion
 	       (array-move-to-cell m-row m-column)
 	       (array-update-buffer-position)
@@ -556,12 +572,12 @@
 	(array-copy-to-column right-column))
       ;; Do the rest of the rows.
       (array-move-to-cell top-row left-column)
-      (let ((copy-string
+      (let ((array-copy-string
 	     (buffer-substring
 	      (point)
 	      (save-excursion
 		(array-move-to-cell top-row right-column)
-		(setq buffer-column (current-column))
+		(setq array-buffer-column (current-column))
 		(array-end-of-field t)
 		(point))))
 	    (this-row top-row))
@@ -573,10 +589,10 @@
 	     (point)
 	     (save-excursion
 	       (array-move-to-cell this-row right-column)
-	       (setq buffer-column (current-column))
+	       (setq array-buffer-column (current-column))
 	       (array-end-of-field t)
 	       (point)))
-	    (insert copy-string)))))
+	    (insert array-copy-string)))))
     (message "Working...done")
     (array-goto-cell p-row p-column)))
 
@@ -587,30 +603,30 @@
 (defun array-make-template ()
   "Create the template of an array."
   (interactive)
-  ;; If there is a conflict between field-width and init-string, resolve it.
+  ;; If there is a conflict between array-field-width and init-string, resolve it.
   (let ((check t)
 	(len))
     (while check
-      (setq init-field (read-input "Initial field value: "))
-      (setq len (length init-field))
-      (if (/= len field-width)
+      (setq array-init-field (read-input "Initial field value: "))
+      (setq len (length array-init-field))
+      (if (/= len array-field-width)
 	  (if (y-or-n-p (format "Change field width to %d? " len))
-	      (progn (setq field-width len)
+	      (progn (setq array-field-width len)
 		     (setq check nil)))
 	(setq check nil))))
   (goto-char (point-min))
   (message "Working...")
   (let ((this-row 1))
     ;; Loop through the rows.
-    (while (<= this-row max-row)
-      (if rows-numbered
+    (while (<= this-row array-max-row)
+      (if array-rows-numbered
 	  (insert (format "%d:\n" this-row)))
       (let ((this-column 1))
 	;; Loop through the columns.
-	(while (<= this-column max-column)
-	  (insert init-field)
-	  (if (and (zerop (% this-column columns-per-line))
-		   (/= this-column max-column))
+	(while (<= this-column array-max-column)
+	  (insert array-init-field)
+	  (if (and (zerop (% this-column array-columns-per-line))
+		   (/= this-column array-max-column))
 	      (newline))
 	  (setq this-column (1+ this-column))))
       (setq this-row (1+ this-row))
@@ -619,21 +635,21 @@
   (array-goto-cell 1 1))
 
 (defun array-reconfigure-rows (new-columns-per-line new-rows-numbered)
-  "Reconfigure the state of `rows-numbered' and `columns-per-line'.
-NEW-COLUMNS-PER-LINE is the desired value of `columns-per-line' and
+  "Reconfigure the state of `array-rows-numbered' and `array-columns-per-line'.
+NEW-COLUMNS-PER-LINE is the desired value of `array-columns-per-line' and
 NEW-ROWS-NUMBERED (a character, either ?y or ?n) is the desired value
-of rows-numbered."
+of array-rows-numbered."
   (interactive "nColumns per line: \ncRows numbered? (y or n) ")
   ;; Check on new-columns-per-line
   (let ((check t))
     (while check
       (if (and (>= new-columns-per-line 1)
-	       (<= new-columns-per-line max-column))
+	       (<= new-columns-per-line array-max-column))
 	  (setq check nil)
 	(setq new-columns-per-line
-	      (string-to-int 
-	       (read-input 
-		(format "Columns per line (1 - %d): " max-column)))))))
+	      (string-to-int
+	       (read-input
+		(format "Columns per line (1 - %d): " array-max-column)))))))
   ;; Check on new-rows-numbered.  It has to be done this way
   ;;  because interactive does not have y-or-n-p.
   (cond
@@ -647,13 +663,13 @@
   (array-update-buffer-position)
   (let* ((main-buffer (buffer-name (current-buffer)))
 	 (temp-buffer (generate-new-buffer " *Array*"))
-	 (temp-max-row max-row)
-	 (temp-max-column max-column)
-	 (old-rows-numbered rows-numbered)
-	 (old-columns-per-line columns-per-line)
-	 (old-lines-per-row lines-per-row)
-	 (old-field-width field-width)
-	 (old-line-length line-length)
+	 (temp-max-row array-max-row)
+	 (temp-max-column array-max-column)
+	 (old-rows-numbered array-rows-numbered)
+	 (old-columns-per-line array-columns-per-line)
+	 (old-lines-per-row array-lines-per-row)
+	 (old-field-width array-field-width)
+	 (old-line-length array-line-length)
 	 (this-row 1))
     (array-update-array-position)
     ;; Do the cutting in a temporary buffer.
@@ -701,12 +717,12 @@
     (let ((inhibit-quit t))
       (set-buffer main-buffer)
       (erase-buffer)
-      (insert-buffer temp-buffer) 
+      (insert-buffer temp-buffer)
       ;; Update local variables.
-      (setq columns-per-line new-columns-per-line)
-      (setq rows-numbered new-rows-numbered)
-      (setq line-length (* old-field-width new-columns-per-line))
-      (setq lines-per-row 
+      (setq array-columns-per-line new-columns-per-line)
+      (setq array-rows-numbered new-rows-numbered)
+      (setq array-line-length (* old-field-width new-columns-per-line))
+      (setq array-lines-per-row
 	    (+ (floor (1- temp-max-column) new-columns-per-line)
 	       (if new-rows-numbered 2 1)))
       (array-goto-cell (or array-row 1) (or array-column 1)))
@@ -716,7 +732,7 @@
 (defun array-expand-rows ()
   "Expand the rows so each fits on one line and remove row numbers."
   (interactive)
-  (array-reconfigure-rows max-column ?n))
+  (array-reconfigure-rows array-max-column ?n))
 
 
 
@@ -728,12 +744,12 @@
 	(t index)))
 
 (defun xor (pred1 pred2)
-  "Returns the logical exclusive or of predicates PRED1 and PRED2."
+  "Return the logical exclusive or of predicates PRED1 and PRED2."
   (and (or pred1 pred2)
        (not (and pred1 pred2))))
 
 (defun current-line ()
-  "Return the current buffer line at point.  The first line is 0." 
+  "Return the current buffer line at point.  The first line is 0."
   (save-excursion
     (beginning-of-line)
     (count-lines (point-min) (point))))
@@ -744,8 +760,8 @@
   (or (and (= column (move-to-column column))
 	   column)
       ;; There is a tab in the way.
-      (if respect-tabs
-	  (error "There is a TAB character in the way.")
+      (if array-respect-tabs
+	  (error "There is a TAB character in the way")
 	(progn
 	  (untabify-backward)
 	  (move-to-column column)))))
@@ -761,7 +777,7 @@
 
 ;;; Array mode.
 
-(defvar array-mode-map nil 
+(defvar array-mode-map nil
   "Keymap used in array mode.")
 
 (if array-mode-map
@@ -798,10 +814,10 @@
 considered to be a two-dimensional set of strings.  The strings are
 NOT recognized as integers or real numbers.
 
-  The array MUST reside at the top of the buffer.  
+  The array MUST reside at the top of the buffer.
 
   TABs are not respected, and may be converted into spaces at any time.
-Setting the variable 'respect-tabs to non-nil will prevent TAB conversion,
+Setting the variable 'array-respect-tabs to non-nil will prevent TAB conversion,
 but will cause many functions to give errors if they encounter one.
 
   Upon entering array mode, you will be prompted for the values of
@@ -811,16 +827,16 @@
 The variables are:
 
 Variables you assign:
-     max-row:          The number of rows in the array.
-     max-column:       The number of columns in the array. 
-     columns-per-line: The number of columns in the array per line of buffer.
-     field-width:      The width of each field, in characters.
-     rows-numbered:    A logical variable describing whether to ignore
+     array-max-row:          The number of rows in the array.
+     array-max-column:       The number of columns in the array.
+     array-columns-per-line: The number of columns in the array per line of buffer.
+     array-field-width:      The width of each field, in characters.
+     array-rows-numbered:    A logical variable describing whether to ignore
                        row numbers in the buffer.
 
 Variables which are calculated:
-     line-length:      The number of characters in a buffer line.
-     lines-per-row:    The number of buffer lines used to display each row.
+     array-line-length:      The number of characters in a buffer line.
+     array-lines-per-row:    The number of buffer lines used to display each row.
 
   The following commands are available (an asterisk indicates it may
 take a numeric prefix argument):
@@ -857,32 +873,32 @@
 
   (interactive)
   ;; Number of rows in the array.
-  (make-local-variable 'max-row)    
+  (make-local-variable 'array-max-row)
   ;; Number of columns in the array.
-  (make-local-variable 'max-column)    
+  (make-local-variable 'array-max-column)
   ;; Number of array columns per line.
-  (make-local-variable 'columns-per-line) 
+  (make-local-variable 'array-columns-per-line)
   ;; Width of a field in the array.
-  (make-local-variable 'field-width)   
+  (make-local-variable 'array-field-width)
   ;; Are rows numbered in the buffer?
-  (make-local-variable 'rows-numbered) 
+  (make-local-variable 'array-rows-numbered)
   ;; Length of a line in the array.
-  (make-local-variable 'line-length)   
+  (make-local-variable 'array-line-length)
   ;; Number of lines per array row.
-  (make-local-variable 'lines-per-row) 
+  (make-local-variable 'array-lines-per-row)
   ;; Current line number of point in the buffer.
-  (make-local-variable 'buffer-line)
+  (make-local-variable 'array-buffer-line)
   ;; Current column number of point in the buffer.
-  (make-local-variable 'buffer-column)
+  (make-local-variable 'array-buffer-column)
   ;; Current array row location of point.
   (make-local-variable 'array-row)
   ;; Current array column location of point.
   (make-local-variable 'array-column)
   ;; Current field string being copied.
-  (make-local-variable 'copy-string)
+  (make-local-variable 'array-copy-string)
   ;; Should TAB conversion be prevented?
-  (make-local-variable 'respect-tabs)
-  (setq respect-tabs nil)
+  (make-local-variable 'array-respect-tabs)
+  (setq array-respect-tabs nil)
   (array-init-local-variables)
   (setq major-mode 'array-mode)
   (setq mode-name "Array")
@@ -898,8 +914,7 @@
 ;;; Initialization functions.  These are not interactive.
 
 (defun array-init-local-variables ()
-  "Initialize the variables associated with the
-array in this buffer."
+  "Initialize the variables associated with the array in this buffer."
   (array-init-max-row)
   (array-init-max-column)
   (array-init-columns-per-line)
@@ -910,42 +925,42 @@
   (message ""))
 
 (defun array-init-max-row (&optional arg)
-  "Initialize the value of max-row."
-  (setq max-row
+  "Initialize the value of `array-max-row'."
+  (setq array-max-row
 	(or arg (string-to-int (read-input "Number of array rows: ")))))
 
 (defun array-init-max-column (&optional arg)
-  "Initialize the value of max-column."
-  (setq max-column
+  "Initialize the value of `array-max-column'."
+  (setq array-max-column
 	(or arg (string-to-int (read-input "Number of array columns: ")))))
 
 (defun array-init-columns-per-line (&optional arg)
-  "Initialize the value of columns-per-line."
-  (setq columns-per-line 
+  "Initialize the value of `array-columns-per-line'."
+  (setq array-columns-per-line
 	(or arg (string-to-int (read-input "Array columns per line: ")))))
 
 (defun array-init-field-width (&optional arg)
-  "Initialize the value of field-width."
-  (setq field-width 
+  "Initialize the value of `array-field-width'."
+  (setq array-field-width
 	(or arg (string-to-int (read-input "Field width: ")))))
 
 (defun array-init-rows-numbered (&optional arg)
-  "Initialize the value of rows-numbered."
-  (setq rows-numbered 
+  "Initialize the value of `array-rows-numbered'."
+  (setq array-rows-numbered
 	(or arg (y-or-n-p "Rows numbered? "))))
 
 (defun array-init-line-length (&optional arg)
-  "Initialize the value of line-length."
-  (setq line-length
+  "Initialize the value of `array-line-length'."
+  (setq array-line-length
 	(or arg
-	  (* field-width columns-per-line))))
+	  (* array-field-width array-columns-per-line))))
 
 (defun array-init-lines-per-row (&optional arg)
-  "Initialize the value of lines-per-row."
-  (setq lines-per-row
+  "Initialize the value of `array-lines-per-row'."
+  (setq array-lines-per-row
 	(or arg
-	  (+ (floor (1- max-column) columns-per-line)
-	     (if rows-numbered 2 1)))))
+	  (+ (floor (1- array-max-column) array-columns-per-line)
+	     (if array-rows-numbered 2 1)))))
 
 (provide 'array)