트릭을 수행합니다. 최소한의 오류 검사 만 수행합니다. 당신이 요청한 sexp를 돌아갑니다
(org-table-to-sexp <location-of-beginning-of-table> <location-of-end-of-table>)
하는 경우 : 사용
인터페이스는 프로그램 인터페이스 중 하나입니다.
대화 형 사용을 원할 경우 다음 명령을 호출하여 region의 테이블에서 작동 할 수 있습니다.
M-x insert-org-table-to-sexp
즉시 현재 버퍼 테이블 후 원하는 sexp 삽입 것이다 : 그래서, 끝으로 이동하고, 유형 테이블의 시작 부분에있는 마크를 설정. 내가 그 기능을 사용하는 방법을 잘 모르겠습니다
(defun org-table-to-sexp-parse-line()
"Helper, returns the current line as a list of strings"
(save-excursion
(save-match-data
(let ((result nil)
(end-of-line (save-excursion (end-of-line) (point))))
(beginning-of-line)
(while (re-search-forward "\\([^|]*\\)|" end-of-line t)
(let ((match (mapconcat 'identity (split-string (match-string-no-properties 1)) " ")))
(if (< 0 (length match))
;; really want to strip spaces from front and back
(push match result))))
(reverse result)))))
(require 'cl)
(defun org-table-to-sexp (b e)
"Parse an org-mode table to sexp"
(save-excursion
(save-match-data
(goto-char b)
(let ((headers (mapcar
(lambda (str)
(make-symbol (concat ":" (upcase str))))
(org-table-to-sexp-parse-line)))
(sexp nil))
(forward-line 1) ;skip |--+--+--| line
(while (< (point) e)
(forward-line 1)
(let ((line-result nil))
(mapcar* (lambda (h e)
(push h line-result)
(push e line-result))
headers
(org-table-to-sexp-parse-line))
(if line-result
(push (reverse line-result)
sexp))))
sexp))))
(defun insert-org-table-to-sexp (b e)
"Convert the table specified by the region and insert the sexp after the table"
(interactive "r")
(goto-char (max b e))
(print (org-table-to-sexp b e) (current-buffer)))
다음은
는 코드입니다. 나는 그것을 .emacs eval'd에 추가했지만 어떻게 사용할지 모르겠다. 사용 방법을 확장 할 수 있다면 정말 고맙겠습니다. – Wraithan@Chris 방금 입력 할 수있는 대화 형 명령을 추가했습니다. 나는 더 큰 질문은 : 어떻게 그것을 사용하고 싶습니까? –