浏览代码

babel: fixes for commit 08e2596

* lisp/ob-core.el (org-babel-graphical-output-file): Use `user-error'
instead of `error'.

* lisp/ob-maxima.el (org-babel-execute:maxima, org-babel-maxima-expand):
* lisp/ob-octave.el (org-babel-execute:octave): Guard
`org-babel-graphical-output-file' with `ignore-errors'.
Aaron Ecay 11 年之前
父节点
当前提交
1be3c409c2
共有 3 个文件被更改,包括 8 次插入7 次删除
  1. 2 2
      lisp/ob-core.el
  2. 2 2
      lisp/ob-maxima.el
  3. 4 3
      lisp/ob-octave.el

+ 2 - 2
lisp/ob-core.el

@@ -2942,8 +2942,8 @@ plus the parameter value."
   "File where a babel block should send graphical output, per PARAMS."
   (unless (assq :file params)
     (if (assq :file-ext params)
-	(error ":file-ext given but no :file generated; did you forget to give a block a #+NAME?")
-      (error "No :file header argument given; cannot create graphical result.")))
+	(user-error ":file-ext given but no :file generated; did you forget to give a block a #+NAME?")
+      (user-error "No :file header argument given; cannot create graphical result.")))
   (and (member "graphics" (cdr (assq :result-params params)))
        (cdr (assq :file params))))
 

+ 2 - 2
lisp/ob-maxima.el

@@ -52,7 +52,7 @@
     (mapconcat 'identity
 	       (list
 		;; graphic output
-		(let ((graphic-file (org-babel-graphical-output-file params)))
+		(let ((graphic-file (ignore-errors (org-babel-graphical-output-file params))))
 		  (if graphic-file
 		      (format
 		       "set_plot_option ([gnuplot_term, png]); set_plot_option ([gnuplot_out_file, %S]);"
@@ -89,7 +89,7 @@ This function is called by `org-babel-execute-src-block'."
                                           (= 0 (length line)))
                                 line))
                             (split-string raw "[\r\n]"))) "\n")))))
-    (if (org-babel-graphical-output-file params)
+    (if (ignore-errors (org-babel-graphical-output-file params))
 	nil
       (org-babel-result-cond result-params
 	result

+ 4 - 3
lisp/ob-octave.el

@@ -82,18 +82,19 @@ end")
 	 (full-body
 	  (org-babel-expand-body:generic
 	   body params (org-babel-variable-assignments:octave params)))
+	 (gfx-file (ignore-errors (org-babel-graphical-output-file params)))
 	 (result (org-babel-octave-evaluate
 		  session
-		  (if (org-babel-graphical-output-file params)
+		  (if gfx-file
 		      (mapconcat 'identity
 				 (list
 				  "set (0, \"defaultfigurevisible\", \"off\");"
 				  full-body
-				  (format "print -dpng %s" (org-babel-graphical-output-file params)))
+				  (format "print -dpng %s" gfx-file))
 				 "\n")
 		    full-body)
 		  result-type matlabp)))
-    (if (org-babel-graphical-output-file params)
+    (if gfx-file
 	nil
       (org-babel-reassemble-table
        result