Browse Source

ob-calc: ensure the *Calculator* buffer exists before it is used

* lisp/ob-calc.el (org-babel-execute:calc): Ensure the *Calculator*
  buffer exists before it is used.
Eric Schulte 10 years ago
parent
commit
c535678792
1 changed files with 2 additions and 0 deletions
  1. 2 0
      lisp/ob-calc.el

+ 2 - 0
lisp/ob-calc.el

@@ -40,6 +40,8 @@
 
 (defun org-babel-execute:calc (body params)
   "Execute a block of calc code with Babel."
+  (unless (get-buffer "*Calculator*")
+    (save-window-excursion (calc) (calc-quit)))
   (let* ((vars (mapcar #'cdr (org-babel-get-header params :var)))
 	 (var-syms (mapcar #'car vars))
 	 (var-names (mapcar #'symbol-name var-syms)))