Function: org-table-to-lisp

org-table-to-lisp is an autoloaded and byte-compiled function defined in org-table.el.gz.

Signature

(org-table-to-lisp &optional TXT)

Documentation

Convert the table at point to a Lisp structure.

The structure will be a list. Each item is either the symbol hline for a horizontal separator line, or a list of field values as strings. The table is taken from the parameter TXT, or from the buffer at point.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
;;;###autoload
(defun org-table-to-lisp (&optional txt)
  "Convert the table at point to a Lisp structure.

The structure will be a list.  Each item is either the symbol `hline'
for a horizontal separator line, or a list of field values as strings.
The table is taken from the parameter TXT, or from the buffer at point."
  (if txt
      (with-temp-buffer
	(buffer-disable-undo)
        (insert txt)
        (goto-char (point-min))
        (org-table-to-lisp))
    (save-excursion
      (goto-char (org-table-begin))
      (let (table)
        (while (progn (skip-chars-forward " \t")
                      (eq (following-char) ?|))
	  (forward-char)
	  (push
	   (if (eq (following-char) ?-)
	       'hline
	     (let (row)
	       (while (progn
                        (skip-chars-forward " \t")
                        (not (eolp)))
                 (let ((q (point)))
                   (skip-chars-forward "^|\n")
                   (goto-char
                    (prog1
                        (let ((p (point)))
                          (unless (eolp) (setq p (1+ p)))
                          p)
                      (skip-chars-backward " \t" q)
                      ;; Preserve text properties.  They are used when
                      ;; calculating cell width.
                      (push (buffer-substring q (point)) row)))))
	       (nreverse row)))
	   table)
	  (forward-line))
	(nreverse table)))))