forked from mirrors/org-mode
misc tweaks
This commit is contained in:
parent
760e811c8c
commit
50abb08479
|
@ -51,7 +51,10 @@ file into their own source-specific files."
|
|||
(org-babel-map-source-blocks (buffer-file-name)
|
||||
(let* ((link (progn (call-interactively 'org-store-link)
|
||||
(org-babel-clean-text-properties (car (pop org-stored-links)))))
|
||||
(source-name (intern (org-babel-get-src-block-name)))
|
||||
(counter 0)
|
||||
(source-name (intern (or (org-babel-get-src-block-name)
|
||||
(progn (setq counter (+ 1 counter))
|
||||
(format "block-%d" counter)))))
|
||||
(info (org-babel-get-src-block-info))
|
||||
(lang (first info))
|
||||
(body (second info))
|
||||
|
@ -60,14 +63,15 @@ file into their own source-specific files."
|
|||
(session (cdr (assoc :session params)))
|
||||
by-lang by-session)
|
||||
;; add the spec for this block to blocks under it's lang and session
|
||||
(setq by-lang (org-babel-alist-pop lang blocks))
|
||||
(setq by-session (org-babel-alist-pop session by-lang))
|
||||
(setq by-lang (cdr (org-babel-alist-pop lang blocks)))
|
||||
(setq by-session (cdr (org-babel-alist-pop session by-lang)))
|
||||
(setq blocks (cons ;; by-language
|
||||
(cons lang (cons ;; by-session
|
||||
(cons session (cons spec by-session)) by-lang))
|
||||
blocks))))
|
||||
;; blocks should contain all source-blocks organized by language
|
||||
;; and session
|
||||
(message "blocks=%S" blocks) ;; debugging
|
||||
(mapc ;; for every language create a file
|
||||
(lambda (by-lang)
|
||||
(let* ((lang (car by-lang))
|
||||
|
@ -79,7 +83,7 @@ file into their own source-specific files."
|
|||
(flet ((to-file (filename specs)
|
||||
(with-temp-file filename
|
||||
(funcall lang-f)
|
||||
(when she-bang (insert she-bang))
|
||||
(when she-bang (insert (concat she-bang "\n")))
|
||||
(comment-region (point) (progn (insert "generated by org-babel-tangle") (point)))
|
||||
(mapc #'org-babel-spec-to-string specs))))
|
||||
;; if there are multiple sessions then break out by session
|
||||
|
|
Loading…
Reference in a new issue