summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-07-05 19:03:25 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-07-05 19:03:45 -0700
commit2538e687dae7dacab6d17f9fce4db7d16474fbaf (patch)
tree7d1ec4f221c8effbeea03256412cfd8b34f76a14
parent07b8908903287b515ba799b16f2444eb6d7dd0f7 (diff)
downloadorg-mode-2538e687dae7dacab6d17f9fce4db7d16474fbaf.tar.gz
babel: updating ob-dot.el and ob-mscgen.el to use ob-eval
-rw-r--r--lisp/ob-dot.el7
-rw-r--r--lisp/ob-mscgen.el28
2 files changed, 17 insertions, 18 deletions
diff --git a/lisp/ob-dot.el b/lisp/ob-dot.el
index e22defd..a42f451 100644
--- a/lisp/ob-dot.el
+++ b/lisp/ob-dot.el
@@ -40,8 +40,10 @@
;;; Code:
(require 'ob)
+(require 'ob-eval)
-(defvar org-babel-default-header-args:dot '((:results . "file") (:exports . "results"))
+(defvar org-babel-default-header-args:dot
+ '((:results . "file") (:exports . "results"))
"Default arguments to use when evaluating a dot source block.")
(defun org-babel-expand-body:dot (body params &optional processed-params)
@@ -57,8 +59,7 @@ called by `org-babel-execute-src-block'."
(cmd (or (cdr (assoc :cmd params)) "dot"))
(in-file (make-temp-file "org-babel-dot")))
(with-temp-file in-file (insert body))
- (message (concat cmd " " in-file " " cmdline " -o " out-file))
- (shell-command (concat cmd " " in-file " " cmdline " -o " out-file))
+ (org-babel-eval (concat cmd " " in-file " " cmdline " -o " out-file) "")
out-file))
(defun org-babel-prep-session:dot (session params)
diff --git a/lisp/ob-mscgen.el b/lisp/ob-mscgen.el
index 256448b..5c9f3e5 100644
--- a/lisp/ob-mscgen.el
+++ b/lisp/ob-mscgen.el
@@ -28,7 +28,8 @@
;; sequence charts. The mscgen utility is used for processing the
;; sequence definition, and must therefore be installed in the system.
;;
-;; Mscgen is available and documented at http://www.mcternan.me.uk/mscgen/index.html
+;; Mscgen is available and documented at
+;; http://www.mcternan.me.uk/mscgen/index.html
;;
;; This code is directly inspired by Eric Schulte's ob-dot.el
;;
@@ -55,6 +56,7 @@
;;; Code:
(require 'ob)
+(require 'ob-eval)
(defvar org-babel-default-header-args:mscgen
'((:results . "file") (:exports . "results"))
@@ -64,22 +66,18 @@
"Expand BODY according to PARAMS, return the expanded body." body)
(defun org-babel-execute:mscgen (body params)
- "Execute a block of Mscgen code with org-babel. This function is
-called by `org-babel-execute-src-block'.
-Default filetype is png. Modify by setting :filetype parameter to mscgen supported formats."
+ "Execute a block of Mscgen code with org-babel. This function
+is called by `org-babel-execute-src-block'. Default filetype is
+png. Modify by setting :filetype parameter to mscgen supported
+formats."
(message "executing Mscgen source code block")
(let* ((out-file (or (cdr (assoc :file params)) "output.png" ))
- exit-code
- (filetype (or (cdr (assoc :filetype params)) "png" ))
- (stderr
- (with-temp-buffer
- (insert body)
- (setq exit-code (org-babel-shell-command-on-region
- (point-min) (point-max) (concat "mscgen -T " filetype " -o " out-file)
- nil 'replace (current-buffer)))
- (buffer-string))))
- (unless (cdr (assoc :file params)) (setq stderr (concat stderr "\nERROR: no output file specified. Add \":file some_name.png\" to the src header" )) (error stderr))
- (if (> exit-code 0) (org-babel-error-notify exit-code stderr))
+ (filetype (or (cdr (assoc :filetype params)) "png" )))
+ (unless (cdr (assoc :file params))
+ (error (concat
+ "\nERROR: no output file specified. "
+ "Add \":file some_name.png\" to the src header")))
+ (org-babel-eval (concat "mscgen -T " filetype " -o " out-file) body)
out-file))
(defun org-babel-prep-session:mscgen (session params)