From 70f965535b07c03a40792237de3a970d1cb57551 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 5 Jan 2015 12:39:26 +0100 Subject: [PATCH] org-table: Ignore filters and hooks in radio tables * lisp/org-table.el (orgtbl-to-generic): Ignore user-defined filters and hooks. * testing/lisp/test-org-table.el (test-org-table/to-generic): Add tests. Suggested-by: Aaron Ecay --- lisp/org-table.el | 6 +++++- testing/lisp/test-org-table.el | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index a2019a52f..e3cfa1af5 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -4778,7 +4778,11 @@ This may be either a string or a function of two arguments: example \"%s\\\\times10^{%s}\". This may also be a property list with column numbers and format strings or functions. :fmt will still be applied after :efmt." - (let ((backend (plist-get params :backend))) + (let ((backend (plist-get params :backend)) + ;; Disable user-defined export filters and hooks. + (org-export-filters-alist nil) + (org-export-before-parsing-hook nil) + (org-export-before-processing-hook nil)) (when (and backend (symbolp backend) (not (org-export-get-backend backend))) (user-error "Unknown :backend value")) (when (or (not backend) (plist-get params :raw)) (require 'ox-org)) diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el index d9fc9e69a..6d09c4034 100644 --- a/testing/lisp/test-org-table.el +++ b/testing/lisp/test-org-table.el @@ -1437,7 +1437,23 @@ See also `test-org-table/copy-field'." (org-string-match-p "/a/" (orgtbl-to-generic (org-table-to-lisp "| /a/ | b |") - '(:backend latex :raw t)))))) + '(:backend latex :raw t))))) + ;; Hooks are ignored. + (should + (equal + "a\nb" + (let* ((fun-list (list (lambda (backend) (search-forward "a") (insert "hook")))) + (org-export-before-parsing-hook fun-list) + (org-export-before-processing-hook fun-list)) + (orgtbl-to-generic (org-table-to-lisp "| a |\n|---|\n| b |") + '(:hline nil))))) + ;; User-defined export filters are ignored. + (should + (equal + "a\nb" + (let ((org-export-filter-table-cell-functions (list (lambda (c b i) "filter")))) + (orgtbl-to-generic (org-table-to-lisp "| a |\n|---|\n| b |") + '(:hline nil)))))) (ert-deftest test-org-table/to-latex () "Test `orgtbl-to-latex' specifications." -- 2.11.4.GIT