summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstardiviner <numbchild@gmail.com>2018-04-12 15:13:02 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-04-12 15:16:04 +0200
commitb088389c6b4eead4d41528b18a273b8a2cd47eb3 (patch)
treebcd37087cb4d2f7cb943e86643f7335faa8f3dd0
parent296b0de4e881b6bd8657dadf7e73fd323f961d8c (diff)
downloadorg-mode-b088389c6b4eead4d41528b18a273b8a2cd47eb3.tar.gz
ob-core: Add document and test for "graphics" format
* doc/org-manual.org: Document value. * lisp/ob-core.el (org-babel-common-header-args-w-values): Handle symbol "graphics". * testing/lisp/test-ob.el (test-ob/result-graphics-link-type-header-argument): New test.
-rw-r--r--doc/org-manual.org3
-rw-r--r--lisp/ob-core.el2
-rw-r--r--testing/lisp/test-ob.el15
3 files changed, 18 insertions, 2 deletions
diff --git a/doc/org-manual.org b/doc/org-manual.org
index c9742a4..3e7ce4c 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17186,6 +17186,7 @@ Format pertains to the type of the result returned by the code block.
Choose one of the options; they are mutually exclusive. The default
follows from the type specified above.
+#+attr_texinfo: :sep ,
- =raw= ::
Interpreted as raw Org mode. Inserted directly into the buffer.
@@ -17224,7 +17225,7 @@ follows from the type specified above.
=raw= or =org= results for later scripting and automated
processing. Usage example: =:results value drawer=.
-- =link= ::
+- =link=, =graphics= ::
Result is a link to the file specified in =:file= header
argument. However, unlike plain =:file=, nothing is written to
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 75311e0..aa4c371 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -414,7 +414,7 @@ then run `org-babel-switch-to-session'."
(post . :any)
(prologue . :any)
(results . ((file list vector table scalar verbatim)
- (raw html latex org code pp drawer link)
+ (raw html latex org code pp drawer link graphics)
(replace silent none append prepend)
(output value)))
(rownames . ((no yes)))
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index add76da..ff86d5e 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -1011,6 +1011,21 @@ echo \"test\"
(insert-file-contents "/tmp/test.txt")
(string= "hello\n" (buffer-string))))))
+(ert-deftest test-ob/result-graphics-link-type-header-argument ()
+ "Ensure that the result is a link to a file.
+The file is just a link to `:file' value. Inhibit non-empty
+result write to `:file' value."
+ (org-test-with-temp-text "
+<point>#+begin_src shell :results value graphics :file \"/tmp/test.txt\"
+echo \"hello\" > /tmp/test.txt
+echo \"test\"
+#+end_src"
+ (org-babel-execute-src-block)
+ (should (search-forward "[[file:/tmp/test.txt]]" nil nil))
+ (should (with-temp-buffer
+ (insert-file-contents "/tmp/test.txt")
+ (string= "hello\n" (buffer-string))))))
+
(ert-deftest test-ob/inline-src_blk-preceded-punct-preceded-by-point ()
(let ((test-line ".src_emacs-lisp[ :results verbatim ]{ \"x\" }")
(org-babel-inline-result-wrap "=%s="))