|
@@ -598,11 +598,7 @@ version."
|
|
|
(org-lparse-par-open-stashed 0)
|
|
|
|
|
|
;; list related vars
|
|
|
- (org-lparse-list-level 0) ; list level starts at 1. A
|
|
|
- ; value of 0 implies we are
|
|
|
- ; outside of any list
|
|
|
- (org-lparse-list-item-count 0)
|
|
|
- org-lparse-list-stack
|
|
|
+ (org-lparse-list-stack '())
|
|
|
|
|
|
;; list-table related vars
|
|
|
org-lparse-list-table-p
|
|
@@ -1081,10 +1077,11 @@ version."
|
|
|
table-buffer (nreverse table-buffer)
|
|
|
table-orig-buffer (nreverse table-orig-buffer))
|
|
|
(org-lparse-end-paragraph)
|
|
|
+ (when org-lparse-list-table-p
|
|
|
+ (error "Regular tables are not allowed in a list-table block"))
|
|
|
(org-lparse-insert 'TABLE table-buffer table-orig-buffer)))
|
|
|
|
|
|
;; Normal lines
|
|
|
-
|
|
|
(t
|
|
|
;; This line either is list item or end a list.
|
|
|
(when (get-text-property 0 'list-item line)
|
|
@@ -2104,8 +2101,6 @@ When TITLE is nil, just close all open levels."
|
|
|
("d" . description)))))
|
|
|
|
|
|
;; following vars are bound during `org-do-lparse'
|
|
|
-(defvar org-lparse-list-level)
|
|
|
-(defvar org-lparse-list-item-count)
|
|
|
(defvar org-lparse-list-stack)
|
|
|
(defvar org-lparse-list-table:table-row)
|
|
|
(defvar org-lparse-list-table:lines)
|
|
@@ -2147,73 +2142,69 @@ When TITLE is nil, just close all open levels."
|
|
|
;; https://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01101.html
|
|
|
|
|
|
(defun org-lparse-begin-list (ltype)
|
|
|
- (incf org-lparse-list-level)
|
|
|
- (push org-lparse-list-item-count org-lparse-list-stack)
|
|
|
- (setq org-lparse-list-item-count 0)
|
|
|
- (cond
|
|
|
- ((not org-lparse-list-table-p)
|
|
|
- (org-lparse-begin 'LIST ltype))
|
|
|
- ;; process LIST-TABLE
|
|
|
- ((= 1 org-lparse-list-level)
|
|
|
- ;; begin LIST-TABLE
|
|
|
- (setq org-lparse-list-table:lines nil)
|
|
|
- (setq org-lparse-list-table:table-row nil))
|
|
|
- ((= 2 org-lparse-list-level)
|
|
|
- (ignore))
|
|
|
- (t
|
|
|
- (org-lparse-begin 'LIST ltype))))
|
|
|
+ (push ltype org-lparse-list-stack)
|
|
|
+ (let ((list-level (length org-lparse-list-stack)))
|
|
|
+ (cond
|
|
|
+ ((not org-lparse-list-table-p)
|
|
|
+ (org-lparse-begin 'LIST ltype))
|
|
|
+ ;; process LIST-TABLE
|
|
|
+ ((= 1 list-level)
|
|
|
+ ;; begin LIST-TABLE
|
|
|
+ (setq org-lparse-list-table:lines nil)
|
|
|
+ (setq org-lparse-list-table:table-row nil))
|
|
|
+ ((= 2 list-level)
|
|
|
+ (ignore))
|
|
|
+ (t
|
|
|
+ (org-lparse-begin 'LIST ltype)))))
|
|
|
|
|
|
(defun org-lparse-end-list (ltype)
|
|
|
- (setq org-lparse-list-item-count (pop org-lparse-list-stack))
|
|
|
- (decf org-lparse-list-level)
|
|
|
- (cond
|
|
|
- ((not org-lparse-list-table-p)
|
|
|
- (org-lparse-end 'LIST ltype))
|
|
|
- ;; process LIST-TABLE
|
|
|
- ((= 0 org-lparse-list-level)
|
|
|
- ;; end LIST-TABLE
|
|
|
- (insert (org-lparse-format-list-table
|
|
|
- (nreverse org-lparse-list-table:lines))))
|
|
|
- ((= 1 org-lparse-list-level)
|
|
|
- (ignore))
|
|
|
- (t
|
|
|
- (org-lparse-end 'LIST ltype))))
|
|
|
+ (pop org-lparse-list-stack)
|
|
|
+ (let ((list-level (length org-lparse-list-stack)))
|
|
|
+ (cond
|
|
|
+ ((not org-lparse-list-table-p)
|
|
|
+ (org-lparse-end 'LIST ltype))
|
|
|
+ ;; process LIST-TABLE
|
|
|
+ ((= 0 list-level)
|
|
|
+ ;; end LIST-TABLE
|
|
|
+ (insert (org-lparse-format-list-table
|
|
|
+ (nreverse org-lparse-list-table:lines))))
|
|
|
+ ((= 1 list-level)
|
|
|
+ (ignore))
|
|
|
+ (t
|
|
|
+ (org-lparse-end 'LIST ltype)))))
|
|
|
|
|
|
(defun org-lparse-begin-list-item (ltype &optional arg headline)
|
|
|
- (incf org-lparse-list-item-count)
|
|
|
- (cond
|
|
|
- ((not org-lparse-list-table-p)
|
|
|
- (org-lparse-begin 'LIST-ITEM ltype arg headline))
|
|
|
- ;; process LIST-TABLE
|
|
|
- ((and (= 1 org-lparse-list-level)
|
|
|
- (= 1 org-lparse-list-item-count))
|
|
|
- ;; begin TABLE-ROW for LIST-TABLE
|
|
|
- (setq org-lparse-list-table:table-row nil)
|
|
|
- (org-lparse-begin-list-table:table-cell))
|
|
|
- ((and (= 2 org-lparse-list-level)
|
|
|
- (= 1 org-lparse-list-item-count))
|
|
|
- ;; begin TABLE-CELL for LIST-TABLE
|
|
|
- (org-lparse-begin-list-table:table-cell))
|
|
|
- (t
|
|
|
- (org-lparse-begin 'LIST-ITEM ltype arg headline))))
|
|
|
+ (let ((list-level (length org-lparse-list-stack)))
|
|
|
+ (cond
|
|
|
+ ((not org-lparse-list-table-p)
|
|
|
+ (org-lparse-begin 'LIST-ITEM ltype arg headline))
|
|
|
+ ;; process LIST-TABLE
|
|
|
+ ((= 1 list-level)
|
|
|
+ ;; begin TABLE-ROW for LIST-TABLE
|
|
|
+ (setq org-lparse-list-table:table-row nil)
|
|
|
+ (org-lparse-begin-list-table:table-cell))
|
|
|
+ ((= 2 list-level)
|
|
|
+ ;; begin TABLE-CELL for LIST-TABLE
|
|
|
+ (org-lparse-begin-list-table:table-cell))
|
|
|
+ (t
|
|
|
+ (org-lparse-begin 'LIST-ITEM ltype arg headline)))))
|
|
|
|
|
|
(defun org-lparse-end-list-item (ltype)
|
|
|
- (decf org-lparse-list-item-count)
|
|
|
- (cond
|
|
|
- ((not org-lparse-list-table-p)
|
|
|
- (org-lparse-end 'LIST-ITEM ltype))
|
|
|
- ;; process LIST-TABLE
|
|
|
- ((and (= 1 org-lparse-list-level)
|
|
|
- (= 0 org-lparse-list-item-count))
|
|
|
- ;; end TABLE-ROW for LIST-TABLE
|
|
|
- (org-lparse-end-list-table:table-cell)
|
|
|
- (push (nreverse org-lparse-list-table:table-row)
|
|
|
- org-lparse-list-table:lines))
|
|
|
- ((= 2 org-lparse-list-level)
|
|
|
- ;; end TABLE-CELL for LIST-TABLE
|
|
|
- (org-lparse-end-list-table:table-cell))
|
|
|
- (t
|
|
|
- (org-lparse-end 'LIST-ITEM ltype))))
|
|
|
+ (let ((list-level (length org-lparse-list-stack)))
|
|
|
+ (cond
|
|
|
+ ((not org-lparse-list-table-p)
|
|
|
+ (org-lparse-end 'LIST-ITEM ltype))
|
|
|
+ ;; process LIST-TABLE
|
|
|
+ ((= 1 list-level)
|
|
|
+ ;; end TABLE-ROW for LIST-TABLE
|
|
|
+ (org-lparse-end-list-table:table-cell)
|
|
|
+ (push (nreverse org-lparse-list-table:table-row)
|
|
|
+ org-lparse-list-table:lines))
|
|
|
+ ((= 2 list-level)
|
|
|
+ ;; end TABLE-CELL for LIST-TABLE
|
|
|
+ (org-lparse-end-list-table:table-cell))
|
|
|
+ (t
|
|
|
+ (org-lparse-end 'LIST-ITEM ltype)))))
|
|
|
|
|
|
(defvar org-lparse-list-table:table-cell-open)
|
|
|
(defun org-lparse-begin-list-table:table-cell ()
|