Browse Source

ob: fix compiler warnings

* lisp/ob-exp.el (org-babel-exp-in-export-file): Now takes the
  language as an argument.
  (org-babel-exp-src-block): Explicitly pass language to
  `org-babel-exp-in-export-file'.
  (org-babel-exp-inline-src-blocks): Removed unused code.
  (org-babel-exp-results): Explicitly pass language to
  `org-babel-exp-in-export-file'.

* lisp/ob.el (org-babel-library-of-babel): declare variable
  (org-babel-tangle-comment-links): declare function
Eric Schulte 10 years ago
parent
commit
03a6844054
2 changed files with 19 additions and 17 deletions
  1. 17 17
      lisp/ob-exp.el
  2. 2 0
      lisp/ob.el

+ 17 - 17
lisp/ob-exp.el

@@ -76,8 +76,9 @@ be indented by this many characters. See
 `org-babel-function-def-export-name' for the definition of a
 source block function.")
 
-(defmacro org-babel-exp-in-export-file (&rest body)
-  `(let* ((lang-headers (intern (concat "org-babel-default-header-args:" lang)))
+(defmacro org-babel-exp-in-export-file (lang &rest body)
+  (declare (indent 1))
+  `(let* ((lang-headers (intern (concat "org-babel-default-header-args:" ,lang)))
 	  (heading (nth 4 (ignore-errors (org-heading-components))))
 	  (link (when org-current-export-file
 		  (org-make-link-string
@@ -125,15 +126,15 @@ none ----- do not display either code or results upon export"
       (when info
 	;; if we're actually going to need the parameters
 	(when (member (cdr (assoc :exports (nth 2 info))) '("both" "results"))
-	  (org-babel-exp-in-export-file
-	   (setf (nth 2 info)
-		 (org-babel-process-params
-		  (org-babel-merge-params
-		   org-babel-default-header-args
-		   (org-babel-params-from-buffer)
-		   (org-babel-params-from-properties lang)
-		   (if (boundp lang-headers) (eval lang-headers) nil)
-		   raw-params))))
+	  (org-babel-exp-in-export-file lang
+	    (setf (nth 2 info)
+		  (org-babel-process-params
+		   (org-babel-merge-params
+		    org-babel-default-header-args
+		    (org-babel-params-from-buffer)
+		    (org-babel-params-from-properties lang)
+		    (if (boundp lang-headers) (eval lang-headers) nil)
+		    raw-params))))
 	  (setf hash (org-babel-sha1-hash info)))
 	;; expand noweb references in the original file
 	(setf (nth 1 info)
@@ -157,8 +158,7 @@ options and are taken from `org-babel-default-inline-header-args'."
 	     (params (nth 2 info)) code-replacement)
 	(save-match-data
 	  (goto-char (match-beginning 2))
-	  (if (org-babel-in-example-or-verbatim)
-	      (buffer-substring (match-beginning 0) (match-end 0))
+	  (when (not (org-babel-in-example-or-verbatim))
 	    ;; expand noweb references in the original file
 	    (setf (nth 1 info)
 		  (if (and (cdr (assoc :noweb params))
@@ -248,12 +248,12 @@ This function is called by `org-babel-exp-do-export'.  The code
 block will be evaluated.  Optional argument SILENT can be used to
 inhibit insertion of results into the buffer."
   (when (and org-export-babel-evaluate
-	     (not (equal hash (org-babel-exp-in-export-file
-			       (org-babel-result-hash)))))
+	     (not (equal hash (org-babel-exp-in-export-file (nth 0 info)
+				(org-babel-result-hash)))))
     (let ((lang (nth 0 info))
 	  (body (nth 1 info)))
-      (setf (nth 2 info) (org-babel-exp-in-export-file
-			  (org-babel-process-params (nth 2 info))))
+      (setf (nth 2 info) (org-babel-exp-in-export-file lang
+			   (org-babel-process-params (nth 2 info))))
       ;; skip code blocks which we can't evaluate
       (when (fboundp (intern (concat "org-babel-execute:" lang)))
 	(org-babel-eval-wipe-error-buffer)

+ 2 - 0
lisp/ob.el

@@ -36,6 +36,7 @@
 
 (defvar org-babel-call-process-region-original)
 (defvar org-src-lang-modes)
+(defvar org-babel-library-of-babel)
 (declare-function show-all "outline" ())
 (declare-function tramp-compat-make-temp-file "tramp-compat"
                   (filename &optional dir-flag))
@@ -68,6 +69,7 @@
 (declare-function org-table-end "org-table" (&optional table-type))
 (declare-function orgtbl-to-generic "org-table" (table params))
 (declare-function orgtbl-to-orgtbl "org-table" (table params))
+(declare-function org-babel-tangle-comment-links "ob-tangle" (&optional info))
 (declare-function org-babel-lob-get-info "ob-lob" nil)
 (declare-function org-babel-ref-split-args "ob-ref" (arg-string))
 (declare-function org-babel-ref-parse "ob-ref" (assignment))