ob-shell: Make `org-babel-shell-initalize' a command

* lisp/ob-shell.el (org-babel-shell-initialize): Add `interactive.
This commit is contained in:
Nicolas Goaziou 2016-07-23 10:47:01 +02:00
parent 0f7df32711
commit 250304bd2e
1 changed files with 12 additions and 11 deletions

View File

@ -41,6 +41,18 @@
(defvar org-babel-default-header-args:shell '())
(defun org-babel-shell-initialize ()
"Define execution functions associated to shell names.
This function has to be called whenever `org-babel-shell-names'
is modified outside the Customize interface."
(interactive)
(dolist (name org-babel-shell-names)
(eval `(defun ,(intern (concat "org-babel-execute:" name))
(body params)
,(format "Execute a block of %s commands with Babel." name)
(let ((shell-file-name ,name))
(org-babel-execute:shell body params))))))
(defcustom org-babel-shell-names
'("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")
"List of names of shell supported by babel shell code blocks.
@ -52,17 +64,6 @@ outside the Customize interface."
(set-default symbol value)
(org-babel-shell-initialize)))
(defun org-babel-shell-initialize ()
"Define execution functions associated to shell names.
This function has to be called whenever `org-babel-shell-names'
is modified outside the Customize interface."
(dolist (name org-babel-shell-names)
(eval `(defun ,(intern (concat "org-babel-execute:" name))
(body params)
,(format "Execute a block of %s commands with Babel." name)
(let ((shell-file-name ,name))
(org-babel-execute:shell body params))))))
(defun org-babel-execute:shell (body params)
"Execute a block of Shell commands with Babel.
This function is called by `org-babel-execute-src-block'."