emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Org-mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Add :special header argument
Date: Sun, 08 Jan 2012 06:12:41 -1000	[thread overview]
Message-ID: <m1boqetbpi.fsf@tsdye.com> (raw)

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

             reply	other threads:[~2012-01-08 16:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-08 16:12 Thomas S. Dye [this message]
2012-01-08 18:24 ` [PATCH] Add :special header argument 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

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=m1boqetbpi.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --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).