]> code.delx.au - gnu-emacs/blobdiff - lisp/array.el
(abs, ceiling, floor): Remove, since they now redefine
[gnu-emacs] / lisp / array.el
index ad7d6c54443fb711be7179fe8d082d959b75b336..0730e1e7d0cbe8c0fe171f9e4bada72c5638e2d3 100644 (file)
@@ -1,10 +1,10 @@
 ;;; array.el --- array editing commands for Gnu Emacs
 
+;; Copyright (C) 1987 Free Software Foundation, Inc.
+
 ;; Author David M. Brown
 ;; Maintainer: FSF
-;; Last-Modified: 30 Jan 1991
-
-;; Copyright (C) 1987 Free Software Foundation, Inc.
+;; Keywords: extensions
 
 ;; This file is part of GNU Emacs.
 
 
 ;;; Commentary:
 
-;;;  Written by dmb%morgoth@harvard.harvard.edu (address is old)
-;;;   (David M. Brown at Goldberg-Zoino & Associates, Inc.)
-;;;  Thanks to cph@kleph.ai.mit.edu for assistance
+;; Commands for editing a buffer interpreted as a rectangular array
+;; or matrix of whitespace-separated strings.  You specify the array
+;; dimensions and some other parameters at startup time.
+
+;;  Written by dmb%morgoth@harvard.harvard.edu (address is old)
+;;   (David M. Brown at Goldberg-Zoino & Associates, Inc.)
+;;  Thanks to cph@kleph.ai.mit.edu for assistance
 
-;;; To do:
-;;;   Smooth initialization process by grokking local variables list
-;;;     at end of buffer or parsing buffer using whitespace as delimiters.
-;;;   Make 'array-copy-column-right faster.
+;; To do:
+;;   Smooth initialization process by grokking local variables list
+;;     at end of buffer or parsing buffer using whitespace as delimiters.
+;;   Make 'array-copy-column-right faster.
 
 \f
 ;;; Code:
@@ -75,7 +79,7 @@ Its ok to be on a row number line."
               (1- (% buffer-line lines-per-row))
             (% buffer-line lines-per-row)))
        ;; Array columns on the current line.
-       (ceiling (1+ buffer-column) field-width))))
+       (1+ (floor buffer-column field-width)))))
 
 (defun array-update-array-position (&optional a-row a-column)
   "Set `array-row' and `array-column' to their current values or
@@ -702,8 +706,8 @@ of rows-numbered."
       (setq rows-numbered new-rows-numbered)
       (setq line-length (* old-field-width new-columns-per-line))
       (setq lines-per-row 
-           (+ (ceiling temp-max-column new-columns-per-line)
-              (if new-rows-numbered 1 0)))
+           (+ (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)))
     (kill-buffer temp-buffer))
   (message "Working...done"))
@@ -722,26 +726,6 @@ of rows-numbered."
        ((> index limit) limit)
        (t index)))
 
-(defun abs (int)
-  "Return the absolute value of INT."
-  (if (< int 0) (- int) int))
-
-
-(defun floor (int1 int2)
-  "Returns the floor of INT1 divided by INT2.
-INT1 may be negative.  INT2 must be positive."
-  (if (< int1 0)
-      (- (ceiling (- int1) int2))
-      (/ int1 int2)))
-
-(defun ceiling (int1 int2)
-  "Returns the ceiling of INT1 divided by INT2.
-Assumes that both arguments are nonnegative."
-  (+ (/ int1 int2)
-     (if (zerop (mod int1 int2))
-        0
-        1)))
-
 (defun xor (pred1 pred2)
   "Returns the logical exclusive or of predicates PRED1 and PRED2."
   (and (or pred1 pred2)
@@ -961,7 +945,7 @@ array in this buffer."
   "Initialize the value of lines-per-row."
   (setq lines-per-row
        (or arg
-         (+ (ceiling max-column columns-per-line)
-            (if rows-numbered 1 0)))))
+         (+ (floor (1- max-column) columns-per-line)
+            (if rows-numbered 2 1)))))
 
 ;;; array.el ends here