Skip to content

Commit

Permalink
feat(org): add marking by table field
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuxuan Kang authored and Yuxuan Kang committed Jan 29, 2022
1 parent 7e5bbe2 commit a33053f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions the-org-mode-expansions.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@
(declare-function org-up-element "org")
(declare-function org-mark-subtree "org")

(defun er/mark-org-table-field ()
(interactive)
(when (and
(org-at-table-p)
(> (length
(string-trim
(save-excursion (org-table-get-field))))
0))
;; Move to beginning of field. Cannot use
;; (org-table-beginning-of-field) here because it moves to the
;; previous field if point is already at beginning.
(org-table-get-field)
(org-table-end-of-field 0)
(set-mark (point))
(org-table-beginning-of-field 0)))

(defun er/mark-org-element ()
(interactive)
(let* ((el (org-element-at-point))
Expand Down Expand Up @@ -105,6 +121,7 @@
(append
(remove #'er/mark-defun er/try-expand-list)
'(org-mark-subtree
er/mark-org-table-field
er/mark-org-element
er/mark-org-element-parent
er/mark-org-code-block
Expand Down

0 comments on commit a33053f

Please sign in to comment.