]> code.delx.au - gnu-emacs/blobdiff - lisp/org/ob-eval.el
* doc/emacs/dired.texi (Shell Commands in Dired): Fix typo.
[gnu-emacs] / lisp / org / ob-eval.el
index 57f4dc509aad7b365b9698b9928a4defd067e335..0ac6ab004b7739f4d16b0fa076db7888cf219c7e 100644 (file)
@@ -1,11 +1,10 @@
 ;;; 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.3
 
 ;; 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)))
@@ -44,7 +44,7 @@
   "Run CMD on BODY.
 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)
@@ -138,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
@@ -247,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-eval.el ends here