如何在org-table中的点获取列名和字段名

问题描述 投票:2回答:1

像这样的表:

|  Time | ---AAA ---  | ---BBB ---  |
|-------+-------------+-------------+
|  9:45 |             |             |
| 10:00 |             |             |
| 10:15 |  i am here  |             |
| 10:30 |             |             |
| 10:45 |             |             |
|-------+-------------+-------------+

当我输入“我在这里”的行时,是否有任何内置函数可以执行此操作?

get-current-column-name(),return "AAA"
get-current-line-name(),return "10:15"
emacs org-mode spacemacs
1个回答
3
投票

我找不到任何内置函数,所以我写它们,希望它有所帮助

(defun dindom/org-table-get-current-colname()
  "get current column name if in org table"
  (if (org-table-p)
      (org-table-get 1 nil)
    (message "not in table!")
    )
  )

(defun dindom/org-table-get-current-linename()
  "get current line name if in org table"
  (if (org-table-p)
      (org-table-get nil 1)
    (message "not in table!")
    )
  )

或使用org-table-get-field:

(defun dindom/org-table-get-current-linename()
  "get current line name if in org table"
  (if (org-table-p)
      (save-excursion
        (org-table-get-field 1)
        )
    (message "not in table!")
    )
  )
© www.soinside.com 2019 - 2024. All rights reserved.