Function: org-table-collapse-header

org-table-collapse-header is a byte-compiled function defined in org-table.el.gz.

Signature

(org-table-collapse-header TABLE &optional SEPARATOR MAX-HEADER-LINES)

Documentation

Collapse the lines before hline into a single header.

The given TABLE is a list of lists as returned by org-table-to-lisp. The leading lines before the first hline symbol are considered forming the table header. This function collapses all leading header lines into a single header line, followed by the hline symbol, and the rest of the TABLE. Header cells are glued together with a space, or the given SEPARATOR.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table-collapse-header (table &optional separator max-header-lines)
  "Collapse the lines before `hline' into a single header.

The given TABLE is a list of lists as returned by `org-table-to-lisp'.
The leading lines before the first `hline' symbol are considered
forming the table header.  This function collapses all leading header
lines into a single header line, followed by the `hline' symbol, and
the rest of the TABLE.  Header cells are glued together with a space,
or the given SEPARATOR."
  (while (eq (car table) 'hline) (pop table))
  (let* ((separator (or separator " "))
	 (max-header-lines (or max-header-lines 4))
	 (trailer table)
	 (header-lines (cl-loop for line in table
				until (eq 'hline line)
				collect (pop trailer))))
    (if (and trailer (<= (length header-lines) max-header-lines))
	(cons (apply #'cl-mapcar
		     (lambda (&rest x)
		       (org-trim
			(mapconcat #'identity x separator)))
		     header-lines)
	      trailer)
      table)))