emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Gauland <mikelygee@no8wireless.co.nz>
To: emacs-orgmode Org-Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] ':wrap nowrap' disable wrapping
Date: Sun, 03 Mar 2013 11:00:36 +1300	[thread overview]
Message-ID: <51327684.1040602@no8wireless.co.nz> (raw)


[-- 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 --]

             reply	other threads:[~2013-03-02 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-02 22:00 Michael Gauland [this message]
2013-03-15  9:33 ` [PATCH] ':wrap nowrap' disable wrapping Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51327684.1040602@no8wireless.co.nz \
    --to=mikelygee@no8wireless.co.nz \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).