Просмотр исходного кода

babel: fix a number of compiler warnings

* Makefile (LISPF): Add ob-calc.el to compiled files.

* lisp/ob-calc.el (org-babel-execute:calc): Fix compiler warnings.

* lisp/ob-lisp.el (slime-process): Declare an external function.
  (slime-eval): Declare an external function.
  (slime-connected-p): Declared an external function.
  (org-babel-lisp-cmd): Add a group to the defcustom specification.
  (org-babel-execute:lisp): Require slime inside function.
  (org-babel-lisp-initiate-session): Require slime inside function.
Eric Schulte 14 лет назад
Родитель
Сommit
5da47e2c2e
3 измененных файлов с 14 добавлено и 6 удалено
  1. 1 0
      Makefile
  2. 4 4
      lisp/ob-calc.el
  3. 9 2
      lisp/ob-lisp.el

+ 1 - 0
Makefile

@@ -125,6 +125,7 @@ LISPF      = 	org.el			\
 		ob-eval.el		\
 		ob-keys.el		\
 		ob-C.el			\
+		ob-calc.el		\
 		ob-ditaa.el		\
 		ob-haskell.el		\
 		ob-perl.el		\

+ 4 - 4
lisp/ob-calc.el

@@ -48,7 +48,7 @@
        (calc-push-list (list (cdr pair)))
        (calc-store-into (car pair)))
      vars)
-    (mapcar
+    (mapc
      (lambda (line)
        (when (> (length line) 0)
 	 (cond
@@ -80,13 +80,13 @@
 					     (calc-pop 1)))
 				       el))
 				   ;; parse line into calc objects
-				   (first (math-read-exprs line))))))))
+				   (car (math-read-exprs line))))))))
 		   (calc-eval line))))))))
      (mapcar #'org-babel-trim
 	     (split-string (org-babel-expand-body:calc body params) "[\n\r]"))))
   (save-excursion
-    (set-buffer (get-buffer "*Calculator*"))
-    (calc-eval (calc-top 1))))
+    (with-current-buffer (get-buffer "*Calculator*")
+      (calc-eval (calc-top 1)))))
 
 (provide 'ob-calc)
 

+ 9 - 2
lisp/ob-lisp.el

@@ -41,13 +41,18 @@
 (require 'ob-ref)
 (require 'ob-comint)
 (require 'ob-eval)
-(require 'slime)
+
+(declare-function slime-eval "ext:slime" (sexp &optional package))
+(declare-function slime-process "ext:slime" (&optional connection))
+(declare-function slime-connected-p "ext:slime" ())
 
 (defvar org-babel-default-header-args:lisp '()
   "Default header arguments for lisp code blocks.")
 
 (defcustom org-babel-lisp-cmd "sbcl --script"
-  "Name of command used to evaluate lisp blocks.")
+  "Name of command used to evaluate lisp blocks."
+  :group 'org-babel
+  :type 'string)
 
 (defun org-babel-expand-body:lisp (body params)
   "Expand BODY according to PARAMS, return the expanded body."
@@ -63,6 +68,7 @@
 (defun org-babel-execute:lisp (body params)
   "Execute a block of Lisp code with org-babel.
 This function is called by `org-babel-execute-src-block'"
+  (require 'slime)
   (message "executing Lisp source code block")
   (let* ((session (org-babel-lisp-initiate-session
 		   (cdr (assoc :session params))))
@@ -94,6 +100,7 @@ This function is called by `org-babel-execute-src-block'"
 (defun org-babel-lisp-initiate-session (&optional session)
   "If there is not a current inferior-process-buffer in SESSION
 then create.  Return the initialized session."
+  (require 'slime)
   (unless (string= session "none")
     (save-window-excursion
       (or (slime-connected-p)