From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: Losing tabs when tangling or editing Date: Mon, 28 May 2012 02:30:58 -1000 Message-ID: References: <1337807919.11721.YahooMailNeo@web161904.mail.bf1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYz6Q-00032F-1Z for emacs-orgmode@gnu.org; Mon, 28 May 2012 08:31:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYz6K-0000Eu-IP for emacs-orgmode@gnu.org; Mon, 28 May 2012 08:31:13 -0400 Received: from oproxy6-pub.bluehost.com ([67.222.54.6]:38989) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SYz6K-0000C3-9W for emacs-orgmode@gnu.org; Mon, 28 May 2012 08:31:08 -0400 In-Reply-To: <1337807919.11721.YahooMailNeo@web161904.mail.bf1.yahoo.com> (Michael Hannon's message of "Wed, 23 May 2012 14:18:39 -0700 (PDT)") 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: Michael Hannon Cc: Org-Mode List Michael Hannon writes: > Greetings.=C2=A0 I was trying to set up a little demo in which I included= a > Makefile inside a "sh" source-code block in an Org-mode file, then tangle= d the > file and ran "make" on the tangled file (either in the actual shell or in > another sh block in Org). > > It appears that Org is removing tabs when it tangles the file, and the la= ck of > tabs causes "make" to complain. > > I've appended a toy example which exhibits the problem.=C2=A0 BTW, if I e= dit the > source block via C-c ' I also lose the tabs, i.e., even before tangling. > > Any thoughts about this? > > Thanks, > > -- Mike Hi Mike, I stumbled across this, too, in a somewhat different context. My "solution" was to hard code the newlines and tabs with \n\t using an emacs-lisp source block and (format), then evaluate to a file, rather than tangle. I don't think it's a pretty solution, but it does work. hth, Tom #+name: configure-makefile #+header: :file Makefile #+header: :var emacs=3D"/Applications/Emacs-23-4.app/Contents/MacOS/Emacs" #+header: :var init-file=3D"init-new.el" #+header: :var exporter=3D"new" #+header: :eval noexport #+BEGIN_SRC emacs-lisp (let ((f (file-name-sans-extension (file-name-nondirectory (buffer-file-name)))) (g (if (string=3D exporter "old") "org-export-as-latex" "org-e-la= tex-export-to-latex"))) (format "CC=3Dgcc EMACS=3D%s BATCH_EMACS=3D$(EMACS) --batch -Q -l %s %s =20=20=20=20 all: %s.pdf =20=20=20=20 %s.tex: %s.org\n\t$(BATCH_EMACS) -f %s =20=20=20=20 %s.pdf: %s.tex\n\trm -f %s.aux\n\tif pdflatex %s.tex > > $ cat Makefile.original=20 > hw:=C2=A0=C2=A0=C2=A0 hw.cpp > =C2=A0=C2=A0=C2=A0 g++ -o hw hw.cpp > > $ grep -P "\t" Makefile.original=20 > hw:=C2=A0=C2=A0=C2=A0 hw.cpp > =C2=A0=C2=A0=C2=A0 g++ -o hw hw.cpp > > $ make -f Makefile.original=20 > g++ -o hw hw.cpp > > $ ./hw > Hello, world! > > $ \rm hw > > $ cat hw.org > * test preservation of tabs when tangling > > #+BEGIN_SRC sh :tangle Makefile.tangled > > hw:=C2=A0=C2=A0=C2=A0 hw.cpp > =C2=A0=C2=A0=C2=A0 g++ -o hw hw.cpp > > #+END_SRC > > $ make -f Makefile.tangled > Makefile.tangled:3: *** missing separator (did you mean TAB instead of 8 > spaces?).=C2=A0 Stop. > > --=20 Thomas S. Dye http://www.tsdye.com