Function: array-move-one-column

array-move-one-column is a byte-compiled function defined in array.el.gz.

Signature

(array-move-one-column SIGN)

Documentation

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.

Source Code

;; Defined in /usr/src/emacs/lisp/array.el.gz
(defun array-move-one-column (sign)
  "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 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 array-max-column) (= sign 1))
	   (error "End of array"))
	  ((and (= array-column 1) (= sign -1))
	   (error "Beginning of array"))
	  (t
	   (cond
	    ;; Going backward from first column on the line.
	    ((and (= sign -1) (= 1 (% array-column array-columns-per-line)))
	     (forward-line -1)
             (array-move-to-column-untabify
	      (* array-field-width (1- array-columns-per-line))))
	    ;; Going forward from last column on the line.
	    ((and (= sign 1) (zerop (% array-column array-columns-per-line)))
	     (forward-line 1))
	    ;; Somewhere in the middle of the line.
	    (t
             (array-move-to-column-untabify (+ (array-beginning-of-field)
                                               (* array-field-width sign)))))
	   (+ array-column sign)))))