From mboxrd@z Thu Jan 1 00:00:00 1970 From: Titus von der Malsburg Subject: Re: [BUG] in last org in indentation of source blocks Date: Thu, 28 May 2015 11:50:03 -0700 Message-ID: <87mw0oy1t0.fsf@posteo.de> References: <87oal4y6ri.fsf@posteo.de> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yy2sf-0000g4-Sa for emacs-orgmode@gnu.org; Thu, 28 May 2015 14:50:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yy2sc-0007T0-Mb for emacs-orgmode@gnu.org; Thu, 28 May 2015 14:50:13 -0400 Received: from mx02.posteo.de ([89.146.194.165]:35543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yy2sc-0007SG-Hp for emacs-orgmode@gnu.org; Thu, 28 May 2015 14:50:10 -0400 In-reply-to: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Thomas S. Dye" Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2015-05-28 Thu 11:15, Thomas S. Dye wrote: > Titus von der Malsburg writes: > >> I can=E2=80=99t reproduce the second indent but I think it=E2=80=99s a b= ug that there is >> any indentation at all. >> >> The documentation of `org-edit-special' (C-x ') says: >> >> Call a special editor for the element at point. =E2=80=A6 >> >> No mention of indentation or other reformatting of my code. >> >> The same goes for `org-edit-src-exit' (C-c C-c) which says: >> >> Kill current sub-editing buffer and return to source buffer. >> >> The edit-in-buffer feature should not touch the indentation. If the >> syntax of the language is sensitive to indentation (e.g. Python) this >> can break the code. Example: >> >> #+BEGIN_SRC python :results output >> print "test" >> #+END_SRC >> >> is invalid Python syntax. >> >> Also having one function perform two very different actions (edit code >> in separate buffer *and* reformat the code) is poor design. At least in >> this special case. When I open the code in a separate buffer but then >> decide not to change it (C-c C-c), I'll end up with extra indentation >> and this will create unnecessary changes when I commit the file in git. > > Does the variable org-src-preserve-indentation get the behavior you're > after? It does. I propose two changes: 1.) The default value `org-src-preserve-indentation' should be t because that is safer (see Python example) and more conservative. (Don=E2=80=99t m= ess with my code!) 2.) The documentation of `org-edit-special' and `org-edit-src-exit' should point out that depending on `org-src-preserve-indentation' the code may be re-indented. Even better would be to remove `org-src-preserve-indentation' and to do the right thing, which is to leave the code untouched. Emacs already has facilities for indenting code. No need to reinvent the wheel. Titus --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVZ2NcAAoJEK40WfPGE2id5UUH/RiDS2Zxf+ty1DyOGk8jAb8v UoEed1JoQmKyfD4IQZ/VfLYRLFpEjB1qMLff30FqlRgliXYdtpBkEI7265wYybo8 JnKIX6aLHoXcvRmz+vQPH1yAK4HGZexm/OhIXpX5/08O2K9bN8jPuPbN+Aw0jx9t TGZ0TmsKBfED5FPQha8Q+nfKJMjCr/5yQlqTudZdOKZfPHAb/AKzAAkgHHZdBXCX CAqnBX7CJHyd7dhThShSsrGlgerXbBj/yTSbrlWJyHy5etoaFoHFx4fAlIhRWVp6 mh+dupdZZ+3UWzRtre0w8dqeubMmL6BYNs45vCmCMJWYIV5icnW7rS+zkq8rP9U= =fw0v -----END PGP SIGNATURE----- --=-=-=--