forked from mirrors/org-mode
org-babel: Add new :results discard header argument
* lisp/ob-core.el (org-babel-result-cond): Unconditionally return nil and suppress all the processing for :results discard. (org-babel-common-header-args-w-values): (org-babel-sha1-hash): Add the new value to know :results value list. * doc/org-manual.org (Handling): * etc/ORG-NEWS (New =:results discard= header argument): Document the new value. Reported-by: Daniel Ortmann <daniel.ortmann@oracle.com> Link: https://orgmode.org/list/87tu2tjary.fsf@localhost
This commit is contained in:
parent
6db75d5602
commit
eed4708b66
|
@ -18487,6 +18487,14 @@ options; they are mutually exclusive.
|
|||
can still be used when referenced from another code block.
|
||||
Usage example: =:results none=.
|
||||
|
||||
- =discard= ::
|
||||
|
||||
Ignore the results completely. This option is similar to =none=,
|
||||
but no processing is performed on the return value. Calling the
|
||||
code block programatically (see [[*How to evaluate source code]]) or by
|
||||
reference (see [[*Passing arguments]] and [[*Noweb Reference Syntax]]) will
|
||||
always yield nil.
|
||||
|
||||
- =append= ::
|
||||
|
||||
Append results to the Org buffer. Latest results are at the bottom.
|
||||
|
|
|
@ -382,6 +382,14 @@ value of ~org-babel-clojure-backend~. For example:
|
|||
(range 2)
|
||||
#+end_src
|
||||
|
||||
*** New =:results discard= header argument
|
||||
|
||||
Unlike =:results none=, the return value of code blocks called with
|
||||
=:results discard= header argument is always ~nil~. Org does not
|
||||
attempt to analyze the results and simply returns nil. This can be
|
||||
useful when the code block is used for side effects only but generates
|
||||
large outputs that may be slow to analyze for Org.
|
||||
|
||||
** New options
|
||||
*** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ then run `org-babel-switch-to-session'."
|
|||
(prologue . :any)
|
||||
(results . ((file list vector table scalar verbatim)
|
||||
(raw html latex org code pp drawer link graphics)
|
||||
(replace silent none append prepend)
|
||||
(replace silent none discard append prepend)
|
||||
(output value)))
|
||||
(rownames . ((no yes)))
|
||||
(sep . :any)
|
||||
|
@ -1345,7 +1345,7 @@ CONTEXT specifies the context of evaluation. It can be `:eval',
|
|||
(lambda (a b) (string< (car a) (car b)))))
|
||||
(let* ((rm (lambda (lst)
|
||||
(dolist (p '("replace" "silent" "none"
|
||||
"append" "prepend"))
|
||||
"discard" "append" "prepend"))
|
||||
(setq lst (remove p lst)))
|
||||
lst))
|
||||
(norm (lambda (arg)
|
||||
|
@ -3289,6 +3289,7 @@ Emacs shutdown.")
|
|||
(declare (indent 1) (debug t))
|
||||
(org-with-gensyms (params)
|
||||
`(let ((,params ,result-params))
|
||||
(unless (member "discard" ,params)
|
||||
(if (or (member "scalar" ,params)
|
||||
(member "verbatim" ,params)
|
||||
(member "html" ,params)
|
||||
|
@ -3301,7 +3302,7 @@ Emacs shutdown.")
|
|||
(member "drawer" ,params))
|
||||
(not (member "table" ,params))))
|
||||
,scalar-form
|
||||
,@table-forms))))
|
||||
,@table-forms)))))
|
||||
|
||||
(defmacro org-babel-temp-directory ()
|
||||
"Return temporary directory suitable for `default-directory'."
|
||||
|
|
Loading…
Reference in New Issue