Function: org-table-insert-hline

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

Signature

(org-table-insert-hline &optional ABOVE)

Documentation

Insert a horizontal-line below the current line into the table.

With prefix ABOVE, insert above the current line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
;;;###autoload
(defun org-table-insert-hline (&optional above)
  "Insert a horizontal-line below the current line into the table.
With prefix ABOVE, insert above 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 (org-table-clean-line
                (buffer-substring (line-beginning-position) (line-end-position))))
	 (col (current-column)))
     (while (string-match "|\\( +\\)|" line)
       (setq line (replace-match
		   (concat "+" (make-string (- (match-end 1) (match-beginning 1))
					    ?-) "|") t t line)))
     (and (string-match "\\+" line) (setq line (replace-match "|" t t line)))
     (beginning-of-line (if above 1 2))
     (insert line "\n")
     (beginning-of-line (if above 1 -1))
     (org-move-to-column col)
     (when org-table-overlay-coordinates (org-table-align)))))