mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-24 07:20:29 +00:00
replaced support for shells
This commit is contained in:
parent
f20d7e54a5
commit
e770100002
@ -35,6 +35,7 @@
|
||||
|
||||
;; language specific files
|
||||
(require 'litorgy-script)
|
||||
(require 'litorgy-shell)
|
||||
(require 'litorgy-lisp)
|
||||
(require 'litorgy-R)
|
||||
|
||||
|
65
litorgy/litorgy-shell.el
Normal file
65
litorgy/litorgy-shell.el
Normal file
@ -0,0 +1,65 @@
|
||||
;;; litorgy-shell.el --- litorgy functions for shell execution
|
||||
|
||||
;; Copyright (C) 2009 Eric Schulte
|
||||
|
||||
;; Author: Eric Schulte
|
||||
;; Keywords: literate programming, reproducible research
|
||||
;; Homepage: http://orgmode.org
|
||||
;; Version: 0.01
|
||||
|
||||
;;; License:
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3, or (at your option)
|
||||
;; any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Litorgy support for evaluating sh, bash, and zsh shells
|
||||
|
||||
;;; Code:
|
||||
(require 'litorgy)
|
||||
|
||||
(defun litorgy-shell-add-interpreter (var cmds)
|
||||
(set-default var cmds)
|
||||
(mapc (lambda (cmd)
|
||||
(setq litorgy-interpreters (cons cmd litorgy-interpreters))
|
||||
(eval
|
||||
`(defun ,(intern (concat "litorgy-execute:" cmd)) (body params)
|
||||
,(concat "Evaluate a block of " cmd " shell with litorgy. This function is
|
||||
called by `litorgy-execute-src-block'. This function is an
|
||||
automatically generated wrapper for `litorgy-shell-execute'.")
|
||||
(litorgy-shell-execute ,cmd body params))))
|
||||
cmds))
|
||||
|
||||
(defcustom litorgy-shell-interpreters '("sh" "bash" "zsh")
|
||||
"List of interpreters of shelling languages which can be
|
||||
executed through litorgy."
|
||||
:group 'litorgy
|
||||
:set 'litorgy-shell-add-interpreter)
|
||||
|
||||
(defun litorgy-shell-execute (cmd body params)
|
||||
"Run CMD on BODY obeying any options set with PARAMS."
|
||||
(message (format "executing %s code block..." cmd))
|
||||
(let ((vars (litorgy-reference-variables params)))
|
||||
(save-window-excursion
|
||||
(with-temp-buffer
|
||||
(if (> (length vars) 0)
|
||||
(error "currently no support for passing variables to shells"))
|
||||
(insert body)
|
||||
(shell-command-on-region (point-min) (point-max) cmd nil 'replace)
|
||||
(buffer-string)))))
|
||||
|
||||
(provide 'litorgy-shell)
|
||||
;;; litorgy-shell.el ends here
|
2
rorg.org
2
rorg.org
@ -99,6 +99,8 @@ First assign the variable with some sort of interpreted line
|
||||
|
||||
|
||||
** resource reference example
|
||||
*Note*: this example is largely *defunct*, see the
|
||||
[[* litorgy plays with tables][litorgy-plays-with-tables]] section below.
|
||||
|
||||
This block holds an array of information written in [[http://www.yaml.org][YAML]]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user