2017-12-27 16 views
2

テーブルのカラム名とフィールド名を取得する方法:私は、「私はここに」行に入力するとORG-テーブルにポイントでこのような

| 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" 

答えて

2

私はどのビルドで機能を見つけることができないので、私はそれらを書く、それは

(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-テーブル-GET-フィールドを使用するのに役立ちます願っています:

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

秒関数はおそらく '(org-table-get nil 1)'すなわち現在の行、列1を使用するべきです。それはそれを対称的にし、save-excursionを避けます。 – Nick

+0

@ニックあなたは正しいです、ありがとう!私のコードでは、私のような初心者にもっとビルドイン能力を見せたいだけです。 – dindom

関連する問題