;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\207" [require ob org-macs shell cl-lib] 2) (defvar org-babel-default-header-args:shell nil) #@164 Define execution functions associated to shell names. This function has to be called whenever `org-babel-shell-names' is modified outside the Customize interface. (defalias 'org-babel-shell-initialize #[0 "\211\205F\211@\301\302\303\304P!\305\306\307\"\310\311DC\312BB\257!\210\301\313\314\303\315P!D\316\306\317\"F!\210\301\320\303\321P!\322BB!\210A\266\202\202\207" [org-babel-shell-names eval defun intern "org-babel-execute:" (body params) format "Execute a block of %s commands with Babel." let shell-file-name ((org-babel-execute:shell body params)) defalias quote "org-babel-variable-assignments:" 'org-babel-variable-assignments:shell "Return list of %s statements assigning to the block's variables." defvar "org-babel-default-header-args:" ('nil)] 10 (#$ . 562) nil]) (byte-code "\300\301\302\303\304DD\305\306\307\310\311\312\313& \210\300\314\302\303\315DD\316\306\307\310\317\320\321& \207" [custom-declare-variable org-babel-shell-names funcall function #[0 "\300\207" [("sh" "bash" "zsh" "fish" "csh" "ash" "dash" "ksh" "mksh" "posh")] 1] "List of names of shell supported by babel shell code blocks.\nCall `org-babel-shell-initialize' when modifying this variable\noutside the Customize interface." :group org-babel :type (repeat (string :tag "Shell name: ")) :set #[514 "\300\"\210\301 \207" [set-default org-babel-shell-initialize] 5 "\n\n(fn SYMBOL VALUE)"] org-babel-shell-results-defaults-to-output #[0 "\300\207" [t] 1] "Let shell execution defaults to \":results output\".\n\nWhen set to t, use \":results output\" when no :results setting\nis set. This is especially useful for inline source blocks.\n\nWhen set to nil, stick to the convention of using :results value\nas the default setting when no :results is set, the \"value\" of\na shell execution being its exit code." boolean :package-version (Org . "9.4")] 10) #@123 Execute a block of Shell commands with Babel. This function is called by `org-babel-execute-src-block'. (fn BODY PARAMS) (defalias 'org-babel-execute:shell #[514 "\301\302\236A!\303\236A\211\205\304\305!!\262\306\236A\211\307\232\203$?\206'\310\235\311\236A\312\313 !#\205:\314P\315\316\n %\317\320\n\236A\321 \236A\"\317\322 \236A\323\f\236A\"#\207" [org-babel-shell-results-defaults-to-output org-babel-sh-initiate-session :session :stdin org-babel-sh-var-to-string org-babel-ref-resolve :result-params ("replace") "value" :cmdline org-babel-expand-body:generic org-babel-variable-assignments:shell "\necho $?" org-babel-reassemble-table org-babel-sh-evaluate org-babel-pick-name :colname-names :colnames :rowname-names :rownames] 15 (#$ . 2430)]) #@93 Prepare SESSION according to the header arguments specified in PARAMS. (fn SESSION PARAMS) (defalias 'org-babel-prep-session:shell #[514 "\301!\302!\303!\204\304\305\"\210\306 \307\310\311\312\313!\314\"\315$\216rq\210\212\316\317\307\320\321\312\313!\322\"\323\324%\"\210,\210\207" [comint-input-filter org-babel-sh-initiate-session org-babel-variable-assignments:shell org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data make-byte-code 0 "\301\300\302\"\207" vconcat vector [set-match-data evaporate] 3 #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] mapc 257 "\211c\210\301\302\303\"\210\304\300!\207" [comint-send-input nil t org-babel-comint-wait-for-output] 4 "\n\n(fn VAR)"] 12 (#$ . 3217)]) #@51 Load BODY into SESSION. (fn SESSION BODY PARAMS) (defalias 'org-babel-load-session:shell #[771 "\300 \301\302\303\304\305!\306\"\307$\216\310\"r\211q\210\311\312p!!b\210\313!c\210)\211\262)\207" [current-window-configuration make-byte-code 0 "\301\300!\207" vconcat vector [set-window-configuration] 2 org-babel-prep-session:shell process-mark get-buffer-process org-babel-chomp] 10 (#$ . 3971)]) #@114 Return a list of statements declaring the values as a generic variable. (fn VARNAME VALUES &optional SEP HLINE) (defalias 'org-babel--variable-assignments:sh-generic #[1026 "\300\301\302##\207" [format "%s=%s" org-babel-sh-var-to-sh] 11 (#$ . 4381)]) #@108 Return a list of statements declaring the values as a bash array. (fn VARNAME VALUES &optional SEP HLINE) (defalias 'org-babel--variable-assignments:bash_array #[1026 "\300\301\211\302\303\304\305\306\307  \"\310\"\311\312%\313#$\207" [format "unset %s\ndeclare -a %s=( %s )" mapconcat make-byte-code 257 "\302\300\301#\207" vconcat vector [org-babel-sh-var-to-sh] 5 "\n\n(fn VALUE)" " "] 16 (#$ . 4647)]) #@118 Return a list of statements declaring the values as bash associative array. (fn VARNAME VALUES &optional SEP HLINE) (defalias 'org-babel--variable-assignments:bash_assoc #[1026 "\300\301\211\302\303\304\305\306\307 \f\f#\310\"\311\312%\313#$\207" [format "unset %s\ndeclare -A %s\n%s" mapconcat make-byte-code 257 "\303\304\300\305@\301\302#\305A\301\302#$\207" vconcat vector [format "%s[%s]=%s" org-babel-sh-var-to-sh] 9 "\n\n(fn ITEMS)" "\n"] 17 (#$ . 5067)]) #@99 Represent the parameters as useful Bash shell variables. (fn VARNAME VALUES &optional SEP HLINE) (defalias 'org-babel--variable-assignments:bash #[1026 ":\2036@\211:\203/\211A\211:\203 \300$\202*\301$\262\2025\301$\207\302$\207" [org-babel--variable-assignments:bash_assoc org-babel--variable-assignments:bash_array org-babel--variable-assignments:sh-generic] 11 (#$ . 5545)]) #@79 Return list of shell statements assigning the block's variables. (fn PARAMS) (defalias 'org-babel-variable-assignments:shell #[257 "\300\236A\301\236A\302\230\205\303\236A\206\304\305\306\307\310\311\312\"\313\"\314\315%\316!\"\207" [:separator :hlines "yes" :hline-string "hline" mapcar make-byte-code 257 "\303\304\n\"\203\305@A\300\301$\207\306@A\300\301$\207" vconcat vector [shell-file-name string-suffix-p "bash" org-babel--variable-assignments:bash org-babel--variable-assignments:sh-generic] 6 "\n\n(fn PAIR)" org-babel--get-vars] 11 (#$ . 5961)]) #@164 Convert an elisp value to a shell variable. Convert an elisp var into a string of shell commands specifying a var of the same value. (fn VAR &optional SEP HLINE) (defalias 'org-babel-sh-var-to-sh #[769 "\300\301\300\302\303##\300Q\207" ["'" replace-regexp-in-string "'\"'\"'" org-babel-sh-var-to-string] 11 (#$ . 6543)]) #@67 Convert an elisp value to a string. (fn VAR &optional SEP HLINE) (defalias 'org-babel-sh-var-to-string #[769 "\300<\203&@<\204@\301=\203&\302\303\206\304\305\306\257\"\2026<\2033\307\310#\2026\211!\207" [#[257 "\211;\203\207\300\301\"\207" [format "%S"] 4 "\n\n(fn V)"] hline orgtbl-to-generic :sep " " :fmt :hline mapconcat "\n"] 12 (#$ . 6877)]) #@86 Initiate a session named SESSION according to PARAMS. (fn &optional SESSION PARAMS) (defalias 'org-babel-sh-initiate-session #[512 "\205.\301\230?\205.\302 \303\304\305\306\307!\310\"\311$\216\312!\206+\313!\210`\314\223\210\315p!)\262\207" [comint-last-output-start "none" current-window-configuration make-byte-code 0 "\301\300!\207" vconcat vector [set-window-configuration] 2 org-babel-comint-buffer-livep shell nil get-buffer] 9 (#$ . 7257)]) #@51 String to indicate that evaluation has completed. (defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'" (#$ . 7722)) #@51 String to indicate that evaluation has completed. (defvar org-babel-sh-eoe-output "org_babel_sh_eoe" (#$ . 7852)) #@268 Pass BODY to the Shell process in BUFFER. If RESULT-TYPE equals `output' then return a list of the outputs of the statements in BODY, if RESULT-TYPE equals `value' then return the value of the last statement in BODY. (fn SESSION BODY &optional PARAMS STDIN CMDLINE) (defalias 'org-babel-sh-evaluate #[1282 "\306\236A\307\236A\211\310\232\203?\206\311\235\204\203\326\312\313!\312\314!\315\236A\316\230?\317\320\321!!\322\323\324\325\326!\327\"\330$\216r\211q\210\203M\331\261\210\203T\331c\210 c\210)r\211q\210\332\333\211\333\323%\210*\266\334\335\"\210\317\320\321!!\322\323\324\325\326!\336\"\330$\216r\211q\210 \206\211\337c\210)r\211q\210\332\333\211\333\323%\210*\266\340\341!r\211q\210\322\323\324\325\326!\342\"\330$\216\343\203\270\202\276\344\345 # \205\307\346\nPPp#\210\347 *\262\266\203\202p\203\364\350\351\352\353\354\355 !\204\355\356\357\"\210\360 \322\323\361\325\326!\362\"\363$\216r q\210\212\364\337C\322\365\366\325\326!\367\"\370\371% B\333\372\373p!!b\210`d{\262|\266\374\375\333\376\2036\377\2029\201B\337\376\201C\337##\266\202\331\"\fC\"\211\203\200\211@\211c\210\201D\333\201E\"\210\212 b\210\201F@\333\201E#)\204y\201G\373p!!\210\202\\A\266\202\202J\210 b\210\212\201F\201HA!\333\201E#\205\240\201F@\333\201E#)\204\257\201G\373p!!\210\202\201\372\373p!!b\210\211c\210\203\340\201I\376\331\201J\201H\206\317\337!#\242\"\203\340\211\242\323\225\333O\240\210\375\242@\")\266\202,\262\330\"\"\331#\202p\201K!\203P\312\313!\315\236A\316\232?\317\320\321!!\322\323\324\325\326!\201L\"\330$\216r\211q\210\331\261\210\203,\331c\210\nc\210)r\211q\210\332\333\211\333\323%\210*\266\334\335\"\210\201M\337\"\266\202\202p\201M \333\376\203`\377\202c\201B\337\376\201C\337##\266\202\"\203\202\201N\375\331\201E#!@\262\211\205,\307\236A\211\201O\235?\205(\201P\235\204\355\201Q\235\204\355\201R\235\204\355\201S\235\204\355\201T\235\204\355\201U\235\204\355\201V\235\204\345\201W\235\204\345\201X\235\204\345\201Y\235\203\361\201Z\235\204\361\202(\312\201[!\211\317\320\321!!\322\323\324\325\326!\201\\\"\330$\216r\211q\210c\210)r\211q\210\332\333\211\333\323%\210*\266\201]!\262\262\262\207" [org-babel-shell-results-defaults-to-output shell-file-name comint-input-filter comint-output-filter-functions org-babel-sh-eoe-indicator comint-last-input-end :shebang :result-params ("replace") "value" org-babel-temp-file "sh-script-" "sh-stdin-" :padline "no" get-buffer-create generate-new-buffer-name " *temp file*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 "\n" write-region nil set-file-modes 493 [buffer-name kill-buffer] "" generate-new-buffer " *temp*" [buffer-name kill-buffer] call-process-shell-command format "%s %s" " " buffer-string mapconcat org-babel-sh-strip-weird-long-prompt mapcar org-trim butlast org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data "\301\300\302\"\207" [set-match-data evaporate] 3 #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] 257 "\300\211\242P\240\207" [] 4 "\n\n(fn TEXT)" process-mark get-buffer-process append split-string replace-regexp-in-string "\\`\\([ ]*\n\\)+" comint-prompt-regexp org-babel-sh-eoe-output "\\`[ \n ]+" "[ \n ]+\\'" comint-send-input t re-search-forward accept-process-output regexp-quote string-match "[ \n]+" org-string-nw-p [buffer-name kill-buffer] org-babel-eval reverse "none" "scalar" "verbatim" "html" "code" "pp" "file" "output" "raw" "org" "drawer" "table" "sh-" [buffer-name kill-buffer] org-babel-import-elisp-from-file] 27 (#$ . 7973)]) #@65 Remove prompt cruft from a string of shell output. (fn STRING) (defalias 'org-babel-sh-strip-weird-long-prompt #[257 "\300\301\"\203\211\302\225\303O\262\202\207" [string-match "^% +[ \n$]+ *" 0 nil] 4 (#$ . 11698)]) (provide 'ob-shell)