emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [Babel] Padlines


From: Sebastien Vauban
Subject: Re: [O] [Babel] Padlines
Date: Mon, 23 Sep 2013 09:31:20 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (windows-nt)

Hi Eric,

Eric Schulte wrote:
> "Sebastien Vauban" <address@hidden> writes:
>> Eric Schulte wrote:
>>> aditya siram <address@hidden> writes:
>>>> What's the rationale for having padlines by default in tangled source? It
>>>> generates wrong programs for languages where whitespace is significant
>>>> (Haskell) and, for me, doesn't noticeably improve the look of the tangled
>>>> file in cases where it isn't.
>>>
>>> It is possible to change the value of default header arguments on a
>>> per-language basis because e.g., while (:padlines "yes") may make sense
>>> for sh, it probably doesn't for Haskell.
>>
>> Could it be possible that ":padline yes" does not insert a blank line in 
>> front
>> of the very first block, only *between* all blocks?
>
> I just pushed up a commit which implements this behavior.  See the
> attached file for an example.
>
> #+Title: Examples with the new padline behavior
>
> #+headers: :tangle pad-yes-with-shebang.sed
> #+headers: :shebang "#!/bin/sed -f" 
> #+headers: :padline "yes"
> #+begin_src sed
>   1 {N;s/\n//1}
> #+end_src
>
> #+headers: :tangle pad-no-with-shebang.sed
> #+headers: :shebang "#!/bin/sed -f"
> #+headers: :padline "no"
> #+begin_src sed
>   1 {N;s/\n//1}
> #+end_src
>
> #+headers: :tangle pad-yes-without-shebang.sed
> #+headers: :padline "yes"
> #+begin_src sed
>   1 {N;s/\n//1}
> #+end_src
> #+headers: :tangle pad-no-without-shebang.sed
> #+headers: :padline "no"
> #+begin_src sed
>   1 {N;s/\n//1}
> #+end_src
>
> 1. Tangle the above four blocks with =C-c C-v t=.
> 2. Execute the following code block to view the contents of the
>    resulting sed files.
>
> #+begin_src sh :results scalar
>   head pad*sed
> #+end_src
>
> #+RESULTS:
> : ==> padline-example.sed <==
> : #!/bin/sed -f
> : 
> : 1 {N;s/\n//1}
> : 
> : ==> pad-no-without-shebang.sed <==
> : 1 {N;s/\n//1}
> : 
> : ==> pad-no-with-shebang.sed <==
> : #!/bin/sed -f
> : 1 {N;s/\n//1}
> : 
> : ==> pad-yes-without-shebang.sed <==
> : 1 {N;s/\n//1}
> : 
> : ==> pad-yes-with-shebang.sed <==
> : #!/bin/sed -f
> : 
> : 1 {N;s/\n//1}

That seems perfect, and solves corner-cases I wouldn't have thought of (with
shebang). Thanks a lot!

Best regards,
  Seb

-- 
Sebastien Vauban




reply via email to

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