emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Add :special header argument
@ 2012-01-08 16:12 Thomas S. Dye
  2012-01-08 18:24 ` Achim Gratz
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas S. Dye @ 2012-01-08 16:12 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

Aloha all,

The attached patch defines a new header argument, :special, which wraps
the results of Org babel source block execution in a #BEGIN_ ... #+END_
block.  The block name is taken from a new variable
org-babel-wrap-special, which is initialized as "results".

I use this in conjunction with org-special-blocks for LaTeX export.  I'm
writing a didactic article where I set off results and format them with
the LaTeX framed package. 

All the best,
Tom


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Special header argument --]
[-- Type: text/x-patch, Size: 2096 bytes --]

From 4a31fd6dc99168315dba91fea5df9f07233ad5e1 Mon Sep 17 00:00:00 2001
From: Thomas Dye <dk@poto.local>
Date: Sun, 8 Jan 2012 06:00:47 -1000
Subject: [PATCH] * lisp/ob.el: Add :special header argument

---
 lisp/ob.el |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/lisp/ob.el b/lisp/ob.el
index 0288eb3..da63675 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -378,7 +378,7 @@ then run `org-babel-pop-to-session'."
     (noweb-ref	. :any)
     (padline	. ((yes no)))
     (results	. ((file list vector table scalar verbatim)
-		    (raw org html latex code pp wrap)
+		    (raw org html latex code pp wrap special)
 		    (replace silent append prepend)
 		    (output value)))
     (rownames	. ((no yes)))
@@ -1622,6 +1622,7 @@ If the path of the link is a file path it is expanded using
       ;; scalar result
       (echo-res result))))
 
+(defvar org-babel-wrap-special "results")
 (defun org-babel-insert-result
   (result &optional result-params info hash indent lang)
   "Insert RESULT into the current buffer.
@@ -1663,6 +1664,10 @@ latex --- results are added inside of a #+BEGIN_LATEX block.
           This is a good option if you code block will output
           latex formatted text.
 
+special --- results are added inside of a #+BEGIN_ ... #+END_
+            block, with the block name taken from the variable
+            org-babel-wrap-special.
+
 code ---- the results are extracted in the syntax of the source
           code of the language being evaluated and are added
           inside of a #+BEGIN_SRC block with the source-code
@@ -1767,6 +1772,8 @@ code ---- the results are extracted in the syntax of the source
 	    (goto-char beg) (if (org-at-table-p) (org-cycle)))
 	   ((member "wrap" result-params)
 	    (wrap ":RESULTS:" ":END:"))
+	   ((member "special" result-params)
+	    (wrap (format "#+BEGIN_%s" org-babel-wrap-special)  (format "#+END_%s" org-babel-wrap-special) ))
 	   ((and (not (proper-list-p result))
 		 (not (member "file" result-params)))
 	    (org-babel-examplize-region beg end results-switches)
-- 
1.7.5.4


[-- Attachment #3: Type: text/plain, Size: 146 bytes --]


-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

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

end of thread, other threads:[~2012-01-12  4:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-08 16:12 [PATCH] Add :special header argument Thomas S. Dye
2012-01-08 18:24 ` Achim Gratz
2012-01-08 19:58   ` Eric Schulte
2012-01-08 21:31     ` Thomas S. Dye
2012-01-12  2:14       ` [PATCH] :wrap header documentation Thomas S. Dye
2012-01-12  2:44         ` Eric Schulte
2012-01-12  4:09           ` Thomas S. Dye

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