diff --git a/contrib/lisp/org-element.el b/contrib/lisp/org-element.el index 825d81b6b..8a0a9da22 100644 --- a/contrib/lisp/org-element.el +++ b/contrib/lisp/org-element.el @@ -1135,8 +1135,8 @@ containing `:begin', `:end', `:number-lines', `:preserve-indent', (defun org-element-example-block-interpreter (example-block contents) "Interpret EXAMPLE-BLOCK element as Org syntax. CONTENTS is nil." - (let ((options (org-element-property :options example-block))) - (concat "#+BEGIN_EXAMPLE" (and options (concat " " options)) "\n" + (let ((switches (org-element-property :switches example-block))) + (concat "#+BEGIN_EXAMPLE" (and switches (concat " " switches)) "\n" (org-remove-indentation (org-element-property :value example-block)) "#+END_EXAMPLE"))) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 94c17b700..d1ccbec68 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -536,9 +536,15 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01")) (ert-deftest test-org-element/example-block-interpreter () "Test example block interpreter." + ;; Without switches. (should (equal (org-test-parse-and-interpret "#+BEGIN_EXAMPLE\nTest\n#+END_EXAMPLE") - "#+BEGIN_EXAMPLE\nTest\n#+END_EXAMPLE\n"))) + "#+BEGIN_EXAMPLE\nTest\n#+END_EXAMPLE\n")) + ;; With switches. + (should + (equal (org-test-parse-and-interpret + "#+BEGIN_EXAMPLE -n -k\n(+ 1 1)\n#+END_EXAMPLE") + "#+BEGIN_EXAMPLE -n -k\n(+ 1 1)\n#+END_EXAMPLE\n"))) (ert-deftest test-org-element/export-block-interpreter () "Test export block interpreter."