From 106ca75307a23a46be99da5bacad3234275fdc30 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 28 Jun 2015 21:09:16 +0200 Subject: [PATCH] org-element: Fix table and table.el mix * lisp/org-element.el (org-element-table-parser): Properly parse an Org table followed by a line starting with a "+". * testing/lisp/test-org-element.el (test-org-element/context): Fix test. --- lisp/org-element.el | 6 ++++-- testing/lisp/test-org-element.el | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index ff0fa75d1..1e6499c15 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -2493,9 +2493,11 @@ Assume point is at the beginning of the table." (let* ((case-fold-search t) (table-begin (point)) (type (if (looking-at "[ \t]*|") 'org 'table.el)) + (end-re (format "^[ \t]*\\($\\|[^| \t%s]\\)" + (if (eq type 'org) "" "+"))) (begin (car affiliated)) (table-end - (if (re-search-forward org-table-any-border-regexp limit 'm) + (if (re-search-forward end-re limit 'move) (goto-char (match-beginning 0)) (point))) (tblfm (let (acc) @@ -2560,7 +2562,7 @@ containing `:begin', `:end', `:contents-begin', `:contents-end', (end-of-line) (skip-chars-backward " \t") (point)))) - (end (progn (forward-line) (point)))) + (end (line-beginning-position 2))) (list 'table-row (list :type type :begin begin diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index c77648663..7e4609656 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -3330,8 +3330,7 @@ Text ;; Do not find objects in table rules. (should (eq 'table-row - (org-test-with-temp-text "| a | b |\n+---+---+\n| c | d |" - (forward-line) + (org-test-with-temp-text "| a | b |\n|---|---|\n| c | d |" (org-element-type (org-element-context))))) ;; Find objects in parsed affiliated keywords. (should -- 2.11.4.GIT