浏览代码

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 <aaronecay@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/93795>
Nicolas Goaziou 10 年之前
父节点
当前提交
70f965535b
共有 2 个文件被更改,包括 22 次插入2 次删除
  1. 5 1
      lisp/org-table.el
  2. 17 1
      testing/lisp/test-org-table.el

+ 5 - 1
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))

+ 17 - 1
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."