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

how to get column name and field name at point in org-table

table 像这样:

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

当我在第 "i am here" 行键入时,是否有任何内置函数可以执行此操作?

get-current-column-name(),return "AAA"
get-current-line-name(),return "10:15"

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

(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!")
    )
  )