diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2013-09-28 06:15:42 -0600 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2013-09-28 06:15:42 -0600 |
commit | ae21350aaa5b3db36f02a2bd67b6d2be6dbce428 (patch) | |
tree | bebd2887665d47e8d5f37dd37cbebb5f1ff9f9ef | |
parent | 6f90d903e6de1ed54f0c1f19ed57d02e9327891c (diff) | |
download | org-mode-ae21350aaa5b3db36f02a2bd67b6d2be6dbce428.tar.gz |
:padline insertion aware of placement in file
* lisp/ob-tangle.el (org-babel-spec-to-string): Remove padline
handling from here as there is insufficient information on context.
(org-babel-tangle): Moved padline handling here where we can test
for placement in the file.
-rw-r--r-- | lisp/ob-tangle.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 8141943..63d0a47 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -243,6 +243,10 @@ used to limit the exported source code blocks by language." (if (file-exists-p file-name) (insert-file-contents file-name)) (goto-char (point-max)) + ;; Handle :padlines unless first line in file + (unless (or (string= "no" (cdr (assoc :padline (nth 4 spec)))) + (= (point) (point-min))) + (insert "\n")) (insert content) (write-region nil nil file-name)))) ;; if files contain she-bangs, then make the executable @@ -307,7 +311,6 @@ that the appropriate major-mode is set. SPEC has the form: (body (nth 5 spec)) (comment (nth 6 spec)) (comments (cdr (assoc :comments (nth 4 spec)))) - (padline (not (string= "no" (cdr (assoc :padline (nth 4 spec)))))) (link-p (or (string= comments "both") (string= comments "link") (string= comments "yes") (string= comments "noweb"))) (link-data (mapcar (lambda (el) @@ -327,7 +330,6 @@ that the appropriate major-mode is set. SPEC has the form: (funcall insert-comment (org-fill-template org-babel-tangle-comment-format-beg link-data))) - (when padline (insert "\n")) (insert (format "%s\n" |