Function: org-table--row-type

org-table--row-type is a byte-compiled function defined in org-table.el.gz.

Signature

(org-table--row-type TYPE N I BACKWARDS RELATIVE DESC)

Documentation

Return relative line of Nth row with type TYPE.

Search starts from relative line I. When BACKWARDS in non-nil, look before I. When RELATIVE is non-nil, the reference is relative. DESC is the original descriptor that started the search, as a string.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table--row-type (type n i backwards relative desc)
  "Return relative line of Nth row with type TYPE.
Search starts from relative line I.  When BACKWARDS in non-nil,
look before I.  When RELATIVE is non-nil, the reference is
relative.  DESC is the original descriptor that started the
search, as a string."
  (let ((l (length org-table-current-line-types)))
    (catch :exit
      (dotimes (_ n)
	(while (and (cl-incf i (if backwards -1 1))
		    (>= i 0)
		    (< i l)
		    (not (eq (aref org-table-current-line-types i) type))
		    ;; We are going to cross a hline.  Check if this is
		    ;; an authorized move.
		    (cond
		     ((not relative))
		     ((not (eq (aref org-table-current-line-types i) 'hline)))
		     ((eq org-table-relative-ref-may-cross-hline t))
		     ((eq org-table-relative-ref-may-cross-hline 'error)
		      (user-error "Row descriptor %s crosses hline" desc))
		     (t (cl-decf i (if backwards -1 1)) ; Step back.
			(throw :exit nil)))))))
    (cond ((or (< i 0) (>= i l))
	   (user-error "Row descriptor %s leads outside table" desc))
	  ;; The last hline doesn't exist.  Instead, point to last row
	  ;; in table.
	  ((= i (1- l)) (1- i))
	  (t i))))