]> code.delx.au - gnu-emacs/blobdiff - lisp/array.el
(nntp-open-server): Send MODE READER command to server.
[gnu-emacs] / lisp / array.el
index 17190b35bc39f9a3a619f75ed8366c7bddfb70e7..0730e1e7d0cbe8c0fe171f9e4bada72c5638e2d3 100644 (file)
@@ -1,11 +1,10 @@
 ;;; array.el --- array editing commands for Gnu Emacs
 
 ;;; array.el --- array editing commands for Gnu Emacs
 
+;; Copyright (C) 1987 Free Software Foundation, Inc.
+
 ;; Author David M. Brown
 ;; Maintainer: FSF
 ;; Author David M. Brown
 ;; Maintainer: FSF
-;; Last-Modified: 30 Jan 1991
-;; Keyword: extensions
-
-;; Copyright (C) 1987 Free Software Foundation, Inc.
+;; Keywords: extensions
 
 ;; This file is part of GNU Emacs.
 
 
 ;; This file is part of GNU Emacs.
 
 
 ;;; Commentary:
 
 
 ;;; 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:
 
 \f
 ;;; Code:
@@ -76,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.
               (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
 
 (defun array-update-array-position (&optional a-row a-column)
   "Set `array-row' and `array-column' to their current values or
@@ -703,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 
       (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"))
       (array-goto-cell (or array-row 1) (or array-column 1)))
     (kill-buffer temp-buffer))
   (message "Working...done"))
@@ -723,26 +726,6 @@ of rows-numbered."
        ((> index limit) limit)
        (t index)))
 
        ((> 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)
 (defun xor (pred1 pred2)
   "Returns the logical exclusive or of predicates PRED1 and PRED2."
   (and (or pred1 pred2)
@@ -962,7 +945,7 @@ array in this buffer."
   "Initialize the value of lines-per-row."
   (setq lines-per-row
        (or arg
   "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
 
 ;;; array.el ends here