diff --git a/.gitignore b/.gitignore index d0e08e960..e07b5aeff 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ other test-tangle.sh test-tangle-none.rb test-tangle-special.rb +test-tangle-load.el diff --git a/lisp/org-babel-tangle.el b/lisp/org-babel-tangle.el index 3d69500f9..2767caaa0 100644 --- a/lisp/org-babel-tangle.el +++ b/lisp/org-babel-tangle.el @@ -142,8 +142,11 @@ code blocks by language." (setq by-lang (cdr (assoc src-lang blocks))) (setq blocks (delq (assoc src-lang blocks) blocks)) (setq blocks (cons (cons src-lang (cons spec by-lang)) blocks)))))) + ;; ensure blocks in the correct order + (setq blocks + (mapcar (lambda (by-lang) (cons (car by-lang) (reverse (cdr by-lang)))) blocks)) ;; blocks should contain all source-blocks organized by language - ;; (message "blocks=%S" blocks) ;; debugging + (message "blocks=%S" blocks) ;; debugging blocks)) (defun org-babel-spec-to-string (spec) diff --git a/test-tangle-load.org b/test-tangle-load.org new file mode 100644 index 000000000..74c8db0e4 --- /dev/null +++ b/test-tangle-load.org @@ -0,0 +1,18 @@ +#+TITLE: testing org-babel-load +#+OPTIONS: toc:nil num:nil ^:nil + +* elisp blocks + +** lets look at the order + +#+begin_src emacs-lisp +(message "I'm the first") +#+end_src + +#+begin_src emacs-lisp +(message "I'm the second") +#+end_src + +#+begin_src emacs-lisp +(message "I'm the third") +#+end_src