So, say I have a literate org file as follows:
#+TITLE: Random Scrap
* Do something
:PROPERTIES:
:tangle: scrap.pl
:comments: org
:END:
#+BEGIN_SRC perl
sub my_func{
my $var = pop;
#+END_SRC
some thoughts here..
and the func continues...
#+BEGIN_SRC perl
my $var1 = $var+1;
}
#+END_SRC
Tangling it to source using C-c C-v C-t
gives me the following ugly code:
# Do something
# :PROPERTIES:
# :tangle: scrap.pl
# :comments: org
# :END:
sub my_func{
my $var = pop;
# some thoughts here..
# and the func continues...
my $var1 = $var+1;
}
My questions are:
Is there a simple way to preserve indentation across source blocks, when all of them are going to tangle to a single file?
Is there a way to avoid the
# :PROPERTIES: ... # :END:
text to come to the header?
It would be great to have the first feature available. Org mode is a great tool for documenting source code. However, the wrong indentations put it off sometimes. At times, I break the code into fragments that indent properly. At other times, it is required to break code elsewhere, and causes issues like this.
Thanks in advance!
EDIT
(setq org-src-preserve-indentation t)
solved my problem partially. The output tangled file now goes like:
# Do something
# :PROPERTIES:
# :tangle: scrap.pl
# :comments: org
# :END:
sub my_func{
my $var = pop;
# some thoughts here..
# and the func continues...
my $var1 = $var+1;
}
However, the comments are still out of indentation. Also, the responsibility of maintaining indentation now lies with me. And the header text is as is...
Any comments/answers? I feel this solution is a bit hacky...