From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabrice Popineau Subject: Re: Python src blocks indent Date: Wed, 17 May 2017 14:45:53 +0200 Message-ID: References: <87mvabr7lj.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114035986e91ca054fb7ac0a" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAyLI-00040t-1T for emacs-orgmode@gnu.org; Wed, 17 May 2017 08:46:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAyLH-0003Kl-4w for emacs-orgmode@gnu.org; Wed, 17 May 2017 08:46:16 -0400 Received: from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:35715) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dAyLH-0003Kg-13 for emacs-orgmode@gnu.org; Wed, 17 May 2017 08:46:15 -0400 Received: by mail-qt0-x235.google.com with SMTP id v27so8062372qtg.2 for ; Wed, 17 May 2017 05:46:14 -0700 (PDT) In-Reply-To: <87mvabr7lj.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: "emacs-orgmode@gnu.org" --001a114035986e91ca054fb7ac0a Content-Type: text/plain; charset="UTF-8" Hi, I mean that in the Org buffer I have for example : #+BEGIN_SRC ipython :session def fact(n): if n == 1: return 1 else: return n * fact(n-1) #+END_SRC That is, there is a 2 spaces indentation of the whole code block, and the code block is properly indented. When I export it, I get : def fact(n): if n == 1: return 1 else: return n * fact(n-1) in the IPython cell (basically, the notebook format is JSON and it is easy to count those spaces in the code string in the JSON file) and the 2 org-edit-src-content-indentation have been removed only on the first line. The other ones have 6 or 10 spaces instead of 4 and 8. Given that changing org-edit-src-content-indentation to 0 fixes this problem, I wonder if there is something wrong in the logic where this variable is used (only one place in org-src). But that could well be that it is not taken into account in places where it should. Regards, Fabrice --001a114035986e91ca054fb7ac0a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I mean that in the Org buffer I hav= e for example :

#+BEGIN_SRC ipython :session
=C2=A0 def fact(n):
=C2=A0 =C2=A0 =C2=A0 if n =3D=3D 1:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 1
=C2=A0 =C2=A0 =C2=A0 else:<= /font>
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 return n * fact(n-1)
#+END_SRC

That is, there is a 2 spaces indentation of the whole code block, a= nd the code block is properly indented.
Whe= n I export it, I get :

= def fact(n):
=C2= =A0 =C2=A0 =C2=A0 if n =3D=3D 1:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 1
=C2=A0 =C2=A0 =C2=A0 else:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 re= turn n * fact(n-1)

in the IPython cell (basically, the notebook form= at is JSON and it is easy to count those spaces in the code string in the J= SON file)
and = the 2 org-edit-src-content-indentation have been removed
<= font face=3D"arial, helvetica, sans-serif">only on the first line. The othe= r ones have 6 or 10 spaces instead of 4 and 8.

Given that changing=C2=A0org-edit-src-content-= indentation to 0 fixes this problem, I won= der if there
is something= wrong in the logic where this variable is used (only one place in org-src)= .
But that could well be = that it is not taken into account in places where it should.

Regards,
=
Fabrice
=


--001a114035986e91ca054fb7ac0a--