X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/0c382083b6b550c26fad8ac7f59b1ba09663e728..c07a4c0b599e0debfb10acdf02ac6559b998a88a:/lisp/org/ob-eval.el diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el index dea39f1208..0ac6ab004b 100644 --- a/lisp/org/ob-eval.el +++ b/lisp/org/ob-eval.el @@ -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. @@ -28,12 +27,13 @@ ;; 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