Function: org-table-insert-row

org-table-insert-row is an autoloaded, interactive and byte-compiled function defined in org-table.el.gz.

Signature

(org-table-insert-row &optional ARG)

Documentation

Insert a new row above the current line into the table.

With prefix ARG, insert below the current line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
;;;###autoload
(defun org-table-insert-row (&optional arg)
  "Insert a new row above the current line into the table.
With prefix ARG, insert below the current line."
  (interactive "P")
  (unless (org-at-table-p) (user-error "Not at a table"))
  (when (eobp) (save-excursion (insert "\n")))
  (unless (string-match-p "|[ \t]*$" (org-current-line-string))
    (org-table-align))
  (org-table-with-shrunk-columns
   (let* ((line (buffer-substring (line-beginning-position) (line-end-position)))
	  (new (org-table-clean-line line)))
     ;; Fix the first field if necessary
     (when (string-match "^[ \t]*| *[#*$] *|" line)
       (setq new (replace-match (match-string 0 line) t t new)))
     (forward-line (if arg 1 0))
     ;; Buffer may not end of a newline character, so ensure
     ;; (forward-line 1) moves point to a new line.
     (unless (bolp) (insert "\n"))
     (let (org-table-may-need-update) (insert-before-markers new "\n"))
     (forward-line -1)
     (re-search-forward "| ?" (line-end-position) t)
     (when (or org-table-may-need-update org-table-overlay-coordinates)
       (org-table-align))
     (when (or (not org-table-fix-formulas-confirm)
	       (funcall org-table-fix-formulas-confirm "Fix formulas? "))
       (org-table-fix-formulas "@" nil (1- (org-table-current-dline)) 1)))))