]> code.delx.au - gnu-emacs/blobdiff - lisp/org/ob-eval.el
Merge from emacs-24 branch
[gnu-emacs] / lisp / org / ob-eval.el
index dea39f12089dc5cf1242b194503faa1448fc434a..0ac6ab004b7739f4d16b0fa076db7888cf219c7e 100644 (file)
@@ -1,11 +1,10 @@
-;;; 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)))
@@ -42,9 +42,9 @@
 
 (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)
@@ -60,8 +60,7 @@ STDERR with `org-babel-eval-error-notify'."
 
 (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
@@ -139,9 +138,9 @@ specifies the value of ERROR-BUFFER."
         (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
@@ -248,8 +247,15 @@ specifies the value of ERROR-BUFFER."
       (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