emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] ob.el Adhere to current :padline header during noweb derefer


From: tom
Subject: [O] [PATCH] ob.el Adhere to current :padline header during noweb dereferencing.
Date: Mon, 23 Jan 2012 21:07:48 +0100

At the moment using the :noweb-ref: property approach on subtrees results in 
the tangled code beeing broken
because the newlines before the #+end_src line are excluded from the output. 
This patch uses :padline
to check if a newline should be added. The default being yes, tangling with 
subtree mangling now produces correct
results; code depending on the (errorneous?) behaviour would be broken though.
---
 lisp/ob.el |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/ob.el b/lisp/ob.el
index 47be708..398a997 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -2211,13 +2211,16 @@ block but are passed literally to the 
\"example-block\"."
                                             (nth 4 i))
                                         source-name)
                              (let* ((body (org-babel-expand-noweb-references 
i))
-                                    (full (if comment
+                                        (padded (if (not (string= "no" (cdr 
(assoc :padline (nth 2 i)))))
+                                                               (concat body 
"\n") 
+                                                               body ))
+                                        (full (if comment
                                               ((lambda (cs)
                                                  (concat (c-wrap (car cs)) "\n"
-                                                         body "\n"
+                                                         padded "\n"
                                                          (c-wrap (cadr cs))))
                                                (org-babel-tangle-comment-links 
i))
-                                            body)))
+                                            padded)))
                                (setq expansion (concat expansion full))))))))
                    expansion)
                  ;; possibly raise an error if named block doesn't exist
-- 
1.7.5.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]