ob-shell.el: Rename `ob-shell-return-value-is-exit-status'

* lisp/ob-shell.el
(org-babel-shell-return-value-is-exit-status): Rename from
`ob-shell-return-value-is-exit-status'.
(org-babel-execute:shell, org-babel-sh-evaluate): Use new name.
(org-babel--variable-assignments:bash_assoc): Fix indentation.
This commit is contained in:
Bastien 2020-02-21 08:26:37 +01:00
parent 97d0514b0b
commit 0c02928eb2
2 changed files with 13 additions and 13 deletions

View File

@ -238,7 +238,7 @@ and headings will be visually numeroted.
You can turn this on/off on a per-file basis with =#+startup: num= or You can turn this on/off on a per-file basis with =#+startup: num= or
=#+startup: nonum=. =#+startup: nonum=.
*** New option ~ob-shell-return-value-is-exit-status~ *** New option ~org-babel-shell-return-value-is-exit-status~
When set to =t=, consider the return value of a shell source code When set to =t=, consider the return value of a shell source code
block is the exit status of its last command. block is the exit status of its last command.

View File

@ -71,7 +71,7 @@ outside the Customize interface."
(set-default symbol value) (set-default symbol value)
(org-babel-shell-initialize))) (org-babel-shell-initialize)))
(defcustom ob-shell-return-value-is-exit-status nil (defcustom org-babel-shell-return-value-is-exit-status nil
"Should we consider the shell exit status as the return value? "Should we consider the shell exit status as the return value?
When this is set to nil (the default), consider that the return When this is set to nil (the default), consider that the return
value of a shell source block is the output of the commands. value of a shell source block is the output of the commands.
@ -90,7 +90,7 @@ This function is called by `org-babel-execute-src-block'."
(when stdin (org-babel-sh-var-to-string (when stdin (org-babel-sh-var-to-string
(org-babel-ref-resolve stdin))))) (org-babel-ref-resolve stdin)))))
(value-is-exit-status (or (cdr (assq :value-is-exit-status params)) (value-is-exit-status (or (cdr (assq :value-is-exit-status params))
ob-shell-return-value-is-exit-status)) org-babel-shell-return-value-is-exit-status))
(cmdline (cdr (assq :cmdline params))) (cmdline (cdr (assq :cmdline params)))
(full-body (concat (full-body (concat
(org-babel-expand-body:generic (org-babel-expand-body:generic
@ -144,15 +144,15 @@ This function is called by `org-babel-execute-src-block'."
(varname values &optional sep hline) (varname values &optional sep hline)
"Return a list of statements declaring the values as bash associative array." "Return a list of statements declaring the values as bash associative array."
(format "unset %s\ndeclare -A %s\n%s" (format "unset %s\ndeclare -A %s\n%s"
varname varname varname varname
(mapconcat (mapconcat
(lambda (items) (lambda (items)
(format "%s[%s]=%s" (format "%s[%s]=%s"
varname varname
(org-babel-sh-var-to-sh (car items) sep hline) (org-babel-sh-var-to-sh (car items) sep hline)
(org-babel-sh-var-to-sh (cdr items) sep hline))) (org-babel-sh-var-to-sh (cdr items) sep hline)))
values values
"\n"))) "\n")))
(defun org-babel--variable-assignments:bash (varname values &optional sep hline) (defun org-babel--variable-assignments:bash (varname values &optional sep hline)
"Represent the parameters as useful Bash shell variables." "Represent the parameters as useful Bash shell variables."
@ -224,7 +224,7 @@ of the statements in BODY, if RESULT-TYPE equals `value' then
return the value of the last statement in BODY." return the value of the last statement in BODY."
(let* ((shebang (cdr (assq :shebang params))) (let* ((shebang (cdr (assq :shebang params)))
(value-is-exit-status (or (cdr (assq :value-is-exit-status params)) (value-is-exit-status (or (cdr (assq :value-is-exit-status params))
ob-shell-return-value-is-exit-status)) org-babel-shell-return-value-is-exit-status))
(results (results
(cond (cond
((or stdin cmdline) ; external shell script w/STDIN ((or stdin cmdline) ; external shell script w/STDIN