emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel-trangle, proble when loop is interrupted by documentation
@ 2018-04-21  8:32 Uwe Brauer
  2018-04-21  9:17 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Brauer @ 2018-04-21  8:32 UTC (permalink / raw)
  To: emacs-orgmode

Hi

Please consider the following test org file
* A test example
,----
| #+BEGIN_SRC matlab :tangle test.m 
| function [ll x]=mitest(A0,x0)
| % initialization 
| format long
| epsi=1.e-3;
| nit=0;
| nmaxit=200;
| Delta=10;
| A=A0;
| while Delta>epsi & nit<nmaxit
|     nit=nit+1; % counter
| #+END_SRC
| Some explanation...
| #+BEGIN_SRC matlab :tangle test.m 
|     y=A*x0;
| end
| #+END_SRC
| The basic idea is.
`----


I have interrupted the while loop by some text, when I now toggle, the
indentation  is broken as you can see.

,----
| function [ll x]=mitest(A0,x0)
| % initialization 
| format long
| epsi=1.e-3;
| nit=0;
| nmaxit=200;
| Delta=10;
| A=A0;
| while Delta>epsi & nit<nmaxit
|     nit=nit+1; % counter
| 
| y=A*x0;
| end
`----

There is an empty line and
y=A*x0 is not indented.

How can this behavior be avoided?

Regards

Uwe Brauer 

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

* Re: org-babel-trangle, proble when loop is interrupted by documentation
  2018-04-21  8:32 org-babel-trangle, proble when loop is interrupted by documentation Uwe Brauer
@ 2018-04-21  9:17 ` Nicolas Goaziou
  2018-04-21 12:15   ` Uwe Brauer
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2018-04-21  9:17 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Uwe Brauer <oub@mat.ucm.es> writes:

> Please consider the following test org file
> * A test example
> ,----
> | #+BEGIN_SRC matlab :tangle test.m 
> | function [ll x]=mitest(A0,x0)
> | % initialization 
> | format long
> | epsi=1.e-3;
> | nit=0;
> | nmaxit=200;
> | Delta=10;
> | A=A0;
> | while Delta>epsi & nit<nmaxit
> |     nit=nit+1; % counter
> | #+END_SRC
> | Some explanation...
> | #+BEGIN_SRC matlab :tangle test.m 
> |     y=A*x0;
> | end
> | #+END_SRC
> | The basic idea is.
> `----
>
>
> I have interrupted the while loop by some text, when I now toggle, the
> indentation  is broken as you can see.
>
> ,----
> | function [ll x]=mitest(A0,x0)
> | % initialization 
> | format long
> | epsi=1.e-3;
> | nit=0;
> | nmaxit=200;
> | Delta=10;
> | A=A0;
> | while Delta>epsi & nit<nmaxit
> |     nit=nit+1; % counter
> | 
> | y=A*x0;
> | end
> `----
>
> There is an empty line and
> y=A*x0 is not indented.
>
> How can this behavior be avoided?

I guess you have to set `org-src-preserve-indentation' globally, or use
"-i" flag for the block, which is locally equivalent.

Regards,

-- 
Nicolas Goaziou

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

* Re: org-babel-trangle, proble when loop is interrupted by documentation
  2018-04-21  9:17 ` Nicolas Goaziou
@ 2018-04-21 12:15   ` Uwe Brauer
  2018-04-21 12:20     ` [SOLVED :padline no] (was: org-babel-trangle, proble when loop is interrupted by documentation) Uwe Brauer
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Brauer @ 2018-04-21 12:15 UTC (permalink / raw)
  To: emacs-orgmode


   > Hello,
   > Uwe Brauer <oub@mat.ucm.es> writes:


   > I guess you have to set `org-src-preserve-indentation' globally, or use
   > "-i" flag for the block, which is locally equivalent.

Great that does it.

However there is still an empty line generated. Any possibility get rid
of this as well, I look a bit in the org-src.el and could no find
anything.

Regards

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

* [SOLVED :padline no] (was: org-babel-trangle, proble when loop is interrupted by documentation)
  2018-04-21 12:15   ` Uwe Brauer
@ 2018-04-21 12:20     ` Uwe Brauer
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Brauer @ 2018-04-21 12:20 UTC (permalink / raw)
  To: emacs-orgmode

>>> "Uwe" == Uwe Brauer <oub@mat.ucm.es> writes:

   >> Hello,
   >> Uwe Brauer <oub@mat.ucm.es> writes:


   >> I guess you have to set `org-src-preserve-indentation' globally, or use
   >> "-i" flag for the block, which is locally equivalent.

I think I found it:

* A test example

#+BEGIN_SRC matlab :tangle test.m :padline no
function [ll x]=mitest(A0,x0)
% initialization 
format long
epsi=1.e-3;
nit=0;
nmaxit=200;
Delta=10;
A=A0;
while Delta>epsi & nit<nmaxit
    nit=nit+1; % counter
#+END_SRC
The basic idea is.
That we do.
We also will
#+BEGIN_SRC matlab :tangle test.m :padline no
    y=A*x0;
end
#+END_SRC

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

end of thread, other threads:[~2018-04-21 12:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-21  8:32 org-babel-trangle, proble when loop is interrupted by documentation Uwe Brauer
2018-04-21  9:17 ` Nicolas Goaziou
2018-04-21 12:15   ` Uwe Brauer
2018-04-21 12:20     ` [SOLVED :padline no] (was: org-babel-trangle, proble when loop is interrupted by documentation) Uwe Brauer

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).