1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-28 10:56:57 +00:00

tangling now preserves order of source-code blocks from the original file

This commit is contained in:
Eric Schulte 2009-08-03 11:00:42 -06:00
parent 96c8457208
commit 9df56be538
3 changed files with 23 additions and 1 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ other
test-tangle.sh
test-tangle-none.rb
test-tangle-special.rb
test-tangle-load.el

View File

@ -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)

18
test-tangle-load.org Normal file
View File

@ -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