summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-06-28 21:09:16 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-06-28 21:09:16 +0200
commit106ca75307a23a46be99da5bacad3234275fdc30 (patch)
tree64dfcb3fa6408cf283a746c5aff6a997e11a4a14
parentf03d96572e9b66090ce80a81fef679cf01910901 (diff)
downloadorg-mode-106ca75307a23a46be99da5bacad3234275fdc30.tar.gz
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.
-rw-r--r--lisp/org-element.el6
-rw-r--r--testing/lisp/test-org-element.el3
2 files changed, 5 insertions, 4 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index ff0fa75..1e6499c 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 c776486..7e46096 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|-<point>--|---|\n| c | d |"
(org-element-type (org-element-context)))))
;; Find objects in parsed affiliated keywords.
(should