From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: [PATCH] Add :special header argument Date: Sun, 08 Jan 2012 06:12:41 -1000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjvMW-0007iZ-8s for emacs-orgmode@gnu.org; Sun, 08 Jan 2012 11:12:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjvMV-0001BF-0Y for emacs-orgmode@gnu.org; Sun, 08 Jan 2012 11:12:48 -0500 Received: from oproxy5-pub.bluehost.com ([67.222.38.55]:51401) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RjvMU-0001B9-QO for emacs-orgmode@gnu.org; Sun, 08 Jan 2012 11:12:46 -0500 Received: from cpe-24-94-66-191.hawaii.res.rr.com ([24.94.66.191] helo=poto) by box472.bluehost.com with esmtpa (Exim 4.76) (envelope-from ) id 1RjvMS-0004mS-66 for emacs-orgmode@gnu.org; Sun, 08 Jan 2012 09:12:45 -0700 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org-mode --=-=-= 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ob.el-Add-special-header-argument.patch Content-Description: Special header argument >From 4a31fd6dc99168315dba91fea5df9f07233ad5e1 Mon Sep 17 00:00:00 2001 From: Thomas Dye 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 --=-=-= -- 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 --=-=-=--