emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* (no subject)
@ 2012-01-23 12:00 Tom Regner
  2012-01-23 16:34 ` Tom Regner
  2012-01-23 20:31 ` Eric Schulte
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Regner @ 2012-01-23 12:00 UTC (permalink / raw)
  To: emacs-orgmode

From aea3adc952de33aa9acad94fbd9baa717b7b1a1e Mon Sep 17 00:00:00 2001
From: Tom Regner <tom@goochesa.de>
Rcpt To: emacs-orgmode@gnu.org
Date: Mon, 23 Jan 2012 12:39:52 +0100
Subject: [PATCH] ob.el Adhere to current :padline header during noweb dereferencing.

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-24  7:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-23 12:00 (no subject) Tom Regner
2012-01-23 16:34 ` Tom Regner
2012-01-23 20:31 ` Eric Schulte
2012-01-24  1:55   ` Tom Regner
2012-01-24  2:49     ` string joining accumulated noweb references Was: " Eric Schulte
2012-01-24  4:46       ` string joining accumulated noweb references Tom Regner
2012-01-24  6:24       ` Achim Gratz
2012-01-24  7:04         ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).