Function: org-table-get-field

org-table-get-field is a byte-compiled function defined in org-table.el.gz.

Signature

(org-table-get-field &optional N REPLACE)

Documentation

Return the value of the field in column N of current row.

N defaults to current column. If REPLACE is a string, replace field with this value. The return value is always the old value.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table-get-field (&optional n replace)
  "Return the value of the field in column N of current row.
N defaults to current column.  If REPLACE is a string, replace
field with this value.  The return value is always the old
value."
  (when n (org-table-goto-column n))
  (skip-chars-backward "^|\n")
  (if (or (bolp) (looking-at-p "[ \t]*$"))
      ;; Before first column or after last one.
      ""
    (looking-at "[^|\r\n]*")
    (let* ((pos (match-beginning 0))
	   (val (buffer-substring pos (match-end 0))))
      (when replace
	(org-table-with-shrunk-field
	 (replace-match (if (equal replace "") " " replace) t t)))
      (goto-char (min (line-end-position) (1+ pos)))
      val)))