diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2011-01-18 09:23:53 -0700 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2011-01-18 09:23:53 -0700 |
commit | 70d338ec46c60f070b7e2b7d5adf82215fee27ea (patch) | |
tree | 710759bdb53b93445fb5aba9958b656c6b058be0 | |
parent | 8eb070990081acf52348bb0708658f5b21bf4ae1 (diff) | |
download | org-mode-70d338ec46c60f070b7e2b7d5adf82215fee27ea.tar.gz |
ob-sh: customize shell quoting format with org-babel-sh-var-quote-fmt.
* lisp/ob-sh.el (org-babel-sh-var-quote-fmt): Now possible to
customize the format string used to escape arguments to shell code
blocks.
-rw-r--r-- | lisp/ob-sh.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/ob-sh.el b/lisp/ob-sh.el index cd5a386..74eb620 100644 --- a/lisp/ob-sh.el +++ b/lisp/ob-sh.el @@ -45,6 +45,12 @@ "Command used to invoke a shell. This will be passed to `shell-command-on-region'") +(defcustom org-babel-sh-var-quote-fmt + "$(cat <<'BABEL_TABLE'\n%s\nBABEL_TABLE\n)" + "Format string used to escape variables when passed to shell scripts." + :group 'org-babel + :type 'string) + (defun org-babel-execute:sh (body params) "Execute a block of Shell commands with Babel. This function is called by `org-babel-execute-src-block'." @@ -100,13 +106,13 @@ var of the same value." (if (listp el) (mapcar #'deep-string el) (org-babel-sh-var-to-sh el sep)))) - (format "$(cat <<'BABEL_TABLE'\n%s\nBABEL_TABLE\n)" + (format org-babel-sh-var-quote-fmt (orgtbl-to-generic (deep-string (if (listp (car var)) var (list var))) (list :sep (or sep "\t"))))) (if (stringp var) (if (string-match "[ \t\n\r]" var) - (format "$(cat <<BABEL_STRING\n%s\nBABEL_STRING\n)" var) + (format org-babel-sh-var-quote-fmt var) (format "%s" var)) (format "%S" var)))) |