Browse Source

ob-exp: check for info before exporting code blocks -- fixes a latex export issue

  Thanks for Nicolas Goaziou for pointing this out

* lisp/ob-exp.el (org-babel-exp-src-blocks): don't attempt to export
  blocks when there is no info match -- this fixes a bug in the latex
  export of code blocks located before the first headline
Eric Schulte 14 years ago
parent
commit
a3dfb1c626
1 changed files with 9 additions and 7 deletions
  1. 9 7
      lisp/ob-exp.el

+ 9 - 7
lisp/ob-exp.el

@@ -97,13 +97,15 @@ none ----- do not display either code or results upon export"
     (goto-char (match-beginning 0))
     (let* ((info (org-babel-get-src-block-info))
 	   (params (nth 2 info)))
-      ;; expand noweb references in the original file
-      (setf (nth 1 info)
-	    (if (and (cdr (assoc :noweb params))
-		     (string= "yes" (cdr (assoc :noweb params))))
-		(org-babel-expand-noweb-references
-		 info (get-file-buffer org-current-export-file))
-	      (nth 1 info)))
+      ;; bail if we couldn't get any info from the block
+      (when info
+	;; expand noweb references in the original file
+	(setf (nth 1 info)
+	      (if (and (cdr (assoc :noweb params))
+		       (string= "yes" (cdr (assoc :noweb params))))
+		  (org-babel-expand-noweb-references
+		   info (get-file-buffer org-current-export-file))
+		(nth 1 info))))
       (org-babel-exp-do-export info 'block))))
 
 (defun org-babel-exp-inline-src-blocks (start end)