emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ':wrap nowrap' disable wrapping
@ 2013-03-02 22:00 Michael Gauland
  2013-03-15  9:33 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Gauland @ 2013-03-02 22:00 UTC (permalink / raw)
  To: emacs-orgmode Org-Mode


[-- Attachment #1.1: Type: text/plain, Size: 343 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: wrap.diff --]
[-- Type: text/x-diff; name="wrap.diff", Size: 2064 bytes --]

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))))))

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ':wrap nowrap' disable wrapping
  2013-03-02 22:00 [PATCH] ':wrap nowrap' disable wrapping Michael Gauland
@ 2013-03-15  9:33 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2013-03-15  9:33 UTC (permalink / raw)
  To: Michael Gauland; +Cc: emacs-orgmode Org-Mode

Hi Michael,

Michael Gauland <mikelygee@no8wireless.co.nz> writes:

> 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.

I'll let Eric have a look at this patch first -- I understand the
problem, but I suspect a solution for :wrap only may not be general
enough (I've not studied the question thoroughly though.)

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-15  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-02 22:00 [PATCH] ':wrap nowrap' disable wrapping Michael Gauland
2013-03-15  9:33 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).