doomemacs/modules/lang/org/autoload/tables.el

42 lines
1.1 KiB
EmacsLisp
Raw Normal View History

;;; org/org/autoload/tables.el -*- lexical-binding: t; -*-
2017-05-19 03:29:00 +02:00
;;
;;; Row/Column traversal
2017-05-19 03:29:00 +02:00
;;;###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))))
2017-05-19 03:29:00 +02:00
;;
;;; Row/Column insertion
2017-05-19 03:29:00 +02:00
;;;###autoload
(defun +org/table-insert-column-left ()
2019-05-04 21:03:59 +02:00
"Insert a new column left of the current column."
2017-05-19 03:29:00 +02:00
(interactive)
(org-table-insert-column)
(org-table-move-column-left))
2017-05-19 03:29:00 +02:00
;;;###autoload
(defun +org/table-insert-row-below ()
"Insert a new row below the current row."
(interactive)
(org-table-insert-row 'below))