From d7355798edc643bbbca7ab1ead2a2e11f37aa64c Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Thu, 29 Oct 2015 13:31:28 +0000 Subject: [PATCH] babel: fix header arg duplication * lisp/ob-core.el (org-babel-process-params): Make idempotent. * testing/lisp/test-ob.el (ob/process-params-no-duplicates): New test. --- lisp/ob-core.el | 8 +++++++- testing/lisp/test-ob.el | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 61753ce..fd6d785 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -1597,7 +1597,13 @@ shown below. (cons :result-type (cond ((member "output" result-params) 'output) ((member "value" result-params) 'value) (t 'value)))) - (org-babel-get-header params :var 'other)))) + (loop for item in params + unless (memq (car item) '(:colname-names + :rowname-names + :result-params + :result-type + :var)) + collect item)))) ;; row and column names (defun org-babel-del-hlines (table) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 508a3ed..c2feb39 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -1477,6 +1477,18 @@ echo \"$data\" (should (equal "foo\\\"bar" (org-babel-script-escape "\"foo\\\\\\\"bar\"")))) +(ert-deftest ob/process-params-no-duplicates () + (should (equal (org-babel-process-params '((:colname-names . 1) + (:rowname-names . 1) + (:result-params . 1) + (:result-type . 1) + (:var . "\"foo\""))) + '((:var) + (:colname-names . 1) + (:rowname-names . 1) + (:result-params . 1) + (:result-type . value))))) + (provide 'test-ob) ;;; test-ob ends here -- 2.6.2