"none" header avoids result post-process

This patch introduces a new header argument which hide all code block
results from Emacs so that they are not processed into Emacs-lisp
objects; a process which may take a great deal of time for large
objects.

* lisp/ob.el (org-babel-common-header-args-w-values): Adding the new
  "none" header argument.
  (org-babel-execute-src-block): Don't do *any* result processing if the
  "none" header argument has been specified.
  (org-babel-sha1-hash): Remove the none header argument from
  header arg lists when calculating cache sums.
  (org-babel-insert-result): Flesh out some documentation.
This commit is contained in:
Eric Schulte 2012-11-16 08:40:46 -07:00
parent 359b10b307
commit d4b739fbf2
1 changed files with 11 additions and 4 deletions

View File

@ -421,7 +421,7 @@ then run `org-babel-pop-to-session'."
(padline . ((yes no))) (padline . ((yes no)))
(results . ((file list vector table scalar verbatim) (results . ((file list vector table scalar verbatim)
(raw html latex org code pp drawer) (raw html latex org code pp drawer)
(replace silent append prepend) (replace silent none append prepend)
(output value))) (output value)))
(rownames . ((no yes))) (rownames . ((no yes)))
(sep . :any) (sep . :any)
@ -562,6 +562,8 @@ block."
(message "executing %s code block%s..." (message "executing %s code block%s..."
(capitalize lang) (capitalize lang)
(if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (if (nth 4 info) (format " (%s)" (nth 4 info)) ""))
(if (member "none" result-params)
(message "result silenced")
(setq result (setq result
((lambda (result) ((lambda (result)
(if (and (eq (cdr (assoc :result-type params)) 'value) (if (and (eq (cdr (assoc :result-type params)) 'value)
@ -581,7 +583,8 @@ block."
(org-babel-insert-result (org-babel-insert-result
result result-params info new-hash indent lang) result result-params info new-hash indent lang)
(run-hooks 'org-babel-after-execute-hook) (run-hooks 'org-babel-after-execute-hook)
result)) result
)))
(setq call-process-region 'org-babel-call-process-region-original)))))) (setq call-process-region 'org-babel-call-process-region-original))))))
(defun org-babel-expand-body:generic (body params &optional var-lines) (defun org-babel-expand-body:generic (body params &optional var-lines)
@ -1028,7 +1031,8 @@ the current subtree."
(sort (copy-sequence (nth 2 info)) (sort (copy-sequence (nth 2 info))
(lambda (a b) (string< (car a) (car b))))) (lambda (a b) (string< (car a) (car b)))))
(let* ((rm (lambda (lst) (let* ((rm (lambda (lst)
(dolist (p '("replace" "silent" "append" "prepend")) (dolist (p '("replace" "silent" "none"
"append" "prepend"))
(setq lst (remove p lst))) (setq lst (remove p lst)))
lst)) lst))
(norm (lambda (arg) (norm (lambda (arg)
@ -1851,7 +1855,10 @@ RESULT-PARAMS can take the following values:
replace - (default option) insert results after the source block replace - (default option) insert results after the source block
replacing any previously inserted results replacing any previously inserted results
silent -- no results are inserted silent -- no results are inserted into the Org-mode buffer but
the results are echoed to the minibuffer and are
ingested by Emacs (a potentially time consuming
process)
file ---- the results are interpreted as a file path, and are file ---- the results are interpreted as a file path, and are
inserted into the buffer using the Org-mode file syntax inserted into the buffer using the Org-mode file syntax