From db314d8ad0dc9282653b630da3857327701fa625 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 13 Aug 2015 22:31:36 +0200 Subject: [PATCH] Fix table detection in non-Org buffers * lisp/org.el (org-at-table-p): Allow local tables without full valid syntax when current buffer is not in Org mode. Reported-by: Benjamin Slade --- lisp/org.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 647abaa6c..eb5a7b25a 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -4498,13 +4498,14 @@ Normal means, no org-mode-specific context." "Non-nil if the cursor is inside an Org table. If TABLE-TYPE is non-nil, also check for table.el-type tables. If `org-enable-table-editor' is nil, return nil unconditionally." - (and org-enable-table-editor - (save-excursion - (beginning-of-line) - (org-looking-at-p (if table-type "[ \t]*[|+]" "[ \t]*|"))) - (let ((element (org-element-lineage (org-element-at-point) '(table) t))) - (and element - (or table-type (eq (org-element-property :type element) 'org)))))) + (and + org-enable-table-editor + (save-excursion + (beginning-of-line) + (org-looking-at-p (if table-type "[ \t]*[|+]" "[ \t]*|"))) + (or (not (derived-mode-p 'org-mode)) + (let ((e (org-element-lineage (org-element-at-point) '(table) t))) + (and e (or table-type (eq (org-element-property :type e) 'org))))))) (defsubst org-table-p () (org-at-table-p)) (defun org-at-table.el-p () -- 2.11.4.GIT