41 lines
1.1 KiB
EmacsLisp
41 lines
1.1 KiB
EmacsLisp
;;; org/org/autoload/tables.el -*- lexical-binding: t; -*-
|
|
|
|
;;
|
|
;;; Row/Column traversal
|
|
|
|
;;;###autoload
|
|
(defun +org/table-previous-row ()
|
|
"Go to the previous row (same column) in the current table. Before doing so,
|
|
re-align the table if necessary. (Necessary because org-mode has a
|
|
`org-table-next-row', but not `org-table-previous-row')"
|
|
(interactive)
|
|
(org-table-maybe-eval-formula)
|
|
(org-table-maybe-recalculate-line)
|
|
(if (and org-table-automatic-realign
|
|
org-table-may-need-update)
|
|
(org-table-align))
|
|
(let ((col (org-table-current-column)))
|
|
(beginning-of-line 0)
|
|
(when (or (not (org-at-table-p)) (org-at-table-hline-p))
|
|
(beginning-of-line))
|
|
(org-table-goto-column col)
|
|
(skip-chars-backward "^|\n\r")
|
|
(when (org-looking-at-p " ")
|
|
(forward-char))))
|
|
|
|
|
|
;;
|
|
;;; Row/Column insertion
|
|
|
|
;;;###autoload
|
|
(defun +org/table-insert-column-left ()
|
|
"Insert a new column left of the current column."
|
|
(interactive)
|
|
(org-table-insert-column)
|
|
(org-table-move-column-left))
|
|
|
|
;;;###autoload
|
|
(defun +org/table-insert-row-below ()
|
|
"Insert a new row below the current row."
|
|
(interactive)
|
|
(org-table-insert-row 'below))
|