-;;; ob-run.el --- org-babel functions for external code evaluation
+;;; ob-eval.el --- org-babel functions for external code evaluation
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2012 Free Software Foundation, Inc.
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research, comint
;; Homepage: http://orgmode.org
-;; Version: 7.01
;; This file is part of GNU Emacs.
;; shell commands.
;;; Code:
-(require 'ob)
(eval-when-compile (require 'cl))
+(defvar org-babel-error-buffer-name "*Org-Babel Error Output*")
+
(defun org-babel-eval-error-notify (exit-code stderr)
"Open a buffer to display STDERR and a message with the value of EXIT-CODE."
- (let ((buf (get-buffer-create "*Org-Babel Error Output*")))
+ (let ((buf (get-buffer-create org-babel-error-buffer-name)))
(with-current-buffer buf
(goto-char (point-max))
(save-excursion (insert stderr)))
(defun org-babel-eval (cmd body)
"Run CMD on BODY.
-If CMD succeeds then return it's results, otherwise display
+If CMD succeeds then return its results, otherwise display
STDERR with `org-babel-eval-error-notify'."
- (let ((err-buff (get-buffer-create "*Org-Babel Error*")) exit-code)
+ (let ((err-buff (get-buffer-create " *Org-Babel Error*")) exit-code)
(with-current-buffer err-buff (erase-buffer))
(with-temp-buffer
(insert body)
(defun org-babel-eval-read-file (file)
"Return the contents of FILE as a string."
- (with-temp-buffer (insert-file-contents
- (org-babel-maybe-remote-file file))
+ (with-temp-buffer (insert-file-contents file)
(buffer-string)))
(defun org-babel-shell-command-on-region (start end command
(if error-buffer
(make-temp-file
(expand-file-name "scor"
- (or (unless (featurep 'xemacs)
- small-temporary-file-directory)
- temporary-file-directory)))
+ (if (featurep 'xemacs)
+ (temp-directory)
+ temporary-file-directory)))
nil))
exit-status)
(if (or replace
(delete-file error-file))
exit-status))
+(defun org-babel-eval-wipe-error-buffer ()
+ "Delete the contents of the Org code block error buffer.
+This buffer is named by `org-babel-error-buffer-name'."
+ (when (get-buffer org-babel-error-buffer-name)
+ (with-current-buffer org-babel-error-buffer-name
+ (delete-region (point-min) (point-max)))))
+
(provide 'ob-eval)
-;; arch-tag: 5328b17f-957d-42d9-94da-a2952682d04d
-;;; ob-comint.el ends here
+
+;;; ob-eval.el ends here