From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Hannon Subject: Re: Losing tabs when tangling or editing Date: Mon, 28 May 2012 14:14:16 -0700 (PDT) Message-ID: <1338239656.10918.YahooMailNeo@web161905.mail.bf1.yahoo.com> References: <1337807919.11721.YahooMailNeo@web161904.mail.bf1.yahoo.com> Reply-To: Michael Hannon Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZ7Ge-0003Aw-Pq for emacs-orgmode@gnu.org; Mon, 28 May 2012 17:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SZ7Gc-00061O-MM for emacs-orgmode@gnu.org; Mon, 28 May 2012 17:14:20 -0400 Received: from nm37-vm6.bullet.mail.bf1.yahoo.com ([72.30.238.206]:28645) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SZ7Gc-000615-Ej for emacs-orgmode@gnu.org; Mon, 28 May 2012 17:14:18 -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: Org-Mode List Thomas S. Dye wrote:=0A>=0A>> Greetings.=A0 I was trying to= set up a little demo in which I included a=0A>> Makefile inside a "sh" sou= rce-code block in an Org-mode file,=0A>> then tangled the file and ran "mak= e" on the tangled file (either in the=0A>> actual shell or in another sh bl= ock in Org).=0A>>=0A>> It appears that Org is removing tabs when it tangles= the file, and the lack=0A>> of tabs causes "make" to complain.=0A>>=0A>> I= 've appended a toy example which exhibits the problem.=A0 BTW, if I edit=0A= >> the source block via C-c ' I also lose the tabs, i.e., even before=0A>> = tangling.=0A>>=0A>> Any thoughts about this?=0A>>=0A=0A> I stumbled across = this, too, in a somewhat different context.=A0 My=0A> "solution" was to har= d code the newlines and tabs with \n\t using an=0A> emacs-lisp source block= and (format), then evaluate to a file, rather=0A> than tangle.=A0 I don't = think it's a pretty solution, but it does work.=0A=0AThanks, Tom.=A0 I admi= re your ingenuity, but I think your work-around is too=0Acomplicated for my= purposes.=A0 I was hoping to use this example to do a bit of=0Asubliminal = proselytizing for Org mode.=A0 If I tell people that to do this they=0Ahave= to hand code a bunch of newlines and tabs, using Emacs lisp at that, I'm= =0Anot gonna win many converts.=0A=0AI was hoping that there might be some = kind of customization possible:=0A=0A=A0=A0=A0 (setq leave-the-bleeping-tab= s-alone t)=0A=0AI looked through ob-tangle.el but didn't see anything obvio= us.=A0 (This is=0Aneither surprising nor conclusive, given my limited lisp = skills.)=0A=0A-- Mike=0A=0A> #+name: configure-makefile=0A> #+header: :file= Makefile=0A> #+header: :var=0A> emacs=3D"/Applications/Emacs-23-4.app/Cont= ents/MacOS/Emacs"=0A> #+header: :var init-file=3D"init-new.el"=0A> #+header= : :var exporter=3D"new"=0A> #+header: :eval noexport=0A> #+BEGIN_SRC emacs-= lisp=0A>=A0=A0=A0=A0 (let ((f (file-name-sans-extension (file-name-nondirec= tory=0A>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (buffer-file-name)))= )=0A>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (g (if (string=3D exporter "old")=0A> "= org-export-as-latex" "org-e-latex-export-to-latex")))=0A>=A0=A0=A0=A0=A0=A0= (format "CC=3Dgcc=0A>=A0=A0=A0=A0 EMACS=3D%s=0A>=A0=A0=A0=A0 BATCH_EMACS= =3D$(EMACS) --batch -Q -l %s %s=0A>=A0=A0 =A0=0A>=A0=A0=A0=A0 all: %s.pdf= =0A>=A0=A0 =A0=0A>=A0=A0=A0=A0 %s.tex: %s.org\n\t$(BATCH_EMACS) -f %s=0A>= =A0=A0 =A0=0A>=A0=A0=A0=A0 %s.pdf: %s.tex\n\trm -f %s.aux\n\tif pdflatex %s= .tex=0A> \\\n\t\tstat=3D$$?; = touch %s.pdf; exit $$stat;=0A> \\\n\tfi\n\tbibtex %s\n\twhile grep=0A> \"Re= run to get\" %s.log; do \\\n\t\tif=0A> pdflatex %s.tex \\\n\t\telse \\\n\t\t\tstat=3D$$?;=0A> touch %s.pdf; exit = $$stat; \\\n\t\tfi;=0A> \\\n\tdone=0A>=A0=A0 =A0=0A>=A0=A0=A0=A0 %s.ps: %s.= pdf\n\tpdf2ps %s.pdf=0A>=A0=A0 =A0=0A>=A0=A0=A0=A0 clean:\n\trm -f *.aux *.= log=A0 *.dvi *.blg *.bbl *.toc *.tex *~ *.out=0A> %s.pdf *.xml *.lot *.lof= =0A>=A0=A0=A0=A0 " emacs init-file (file-name-nondirectory (buffer-file-nam= e)) f f f g f=0A> f f f f f f f f f f f f))=0A> #+END_SRC=0A>=0A>=0A>>=0A>>= =0A>> $ cat Makefile.original=0A>> hw:=A0=A0=A0 hw.cpp=0A>>=A0=A0=A0=A0 g++= -o hw hw.cpp=0A>>=0A>> $ grep -P "\t" Makefile.original=0A>> hw:=A0=A0=A0 = hw.cpp=0A>>=A0=A0=A0=A0 g++ -o hw hw.cpp=0A>>=0A>> $ make -f Makefile.origi= nal=0A>> g++ -o hw hw.cpp=0A>>=0A>> $ ./hw=0A>> Hello, world!=0A>>=0A>> $ \= rm hw=0A>>=0A>> $ cat hw.org=0A>> * test preservation of tabs when tangling= =0A>>=0A>> #+BEGIN_SRC sh :tangle Makefile.tangled=0A>>=0A>> hw:=A0=A0=A0 h= w.cpp=0A>>=A0=A0=A0=A0 g++ -o hw hw.cpp=0A>>=0A>> #+END_SRC=0A>>=0A>> $ mak= e -f Makefile.tangled=0A>> Makefile.tangled:3: *** missing separator (did y= ou mean TAB instead of 8=0A>> spaces?).=A0 Stop.