Babel: Disable wrapping * lisp/ob-core.el (org-babel-insert-result): If the argument to ':wrap' is 'nowrap', don't wrap the results.
* doc/org.texi (Header Arguments): Describe 'nowrap' behaviour. This allows the results of a block to be inserted without wrapping, by overriding a ':wrap' property defined in an enclosing scope.
diff --git a/doc/org.texi b/doc/org.texi
index bd22c7a..7fe49d2 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -13972,6 +13972,10 @@ to @code{#+BEGIN_} and @code{#+END_}, which will then be used to wrap the
results. If not string is specified then the results will be wrapped in a
@code{#+BEGIN/END_RESULTS} block.
+The string ``nowrap'' (case insensitive) is treated specially. It will
+disable wrapping, if it has been turned on by setting the :wrap property at
+a higher outline level.
+
@node Results of evaluation, Noweb reference syntax, Header arguments, Working With Source Code
@section Results of evaluation
@cindex code block, results of evaluation
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 275a4f7..bf84ef0 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1893,6 +1893,13 @@ org ----- results are added inside of a \"#+BEGIN_SRC org\" block.
They are not comma-escaped when inserted, but Org syntax
here will be discarded when exporting the file.
+wrap ---- if no argument is supplied, the results are added
+ inside a #+BEGIN_RESULTS block. If a string argument
+ is provided, the string is appended to #+BEGIN_ and
+ #+END_ to delimit the block, unless the string is
+ 'nowrap' (case insensitive), in which case the results
+ will *not* be wrapped.
+
html ---- results are added inside of a #+BEGIN_HTML block. This
is a good option if you code block will output html
formatted text.
@@ -2009,7 +2016,10 @@ code ---- the results are extracted in the syntax of the source
(setq end (point-marker))
;; possibly wrap result
(cond
- ((assoc :wrap (nth 2 info))
+ ((let ((w (assoc :wrap (nth 2 info))))
+ (and w
+ (or (not (stringp (cdr w)))
+ (not (string= (upcase (cdr w)) "NOWRAP")))))
(let ((name (or (cdr (assoc :wrap (nth 2 info))) "RESULTS")))
(funcall wrap (concat "#+BEGIN_" name)
(concat "#+END_" (car (org-split-string name))))))
signature.asc
Description: OpenPGP digital signature
