From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: sometimes we don't want org-src to remove tabs [WAS: Re: tangle and Makefile]] Date: Thu, 28 Jan 2010 19:21:50 +0100 Message-ID: References: <4B616C72.2000707@ifi.uio.no> <87eilaqli4.fsf@stats.ox.ac.uk> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NadX6-0006Ip-4I for emacs-orgmode@gnu.org; Thu, 28 Jan 2010 18:12:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NadX1-0006GN-E5 for emacs-orgmode@gnu.org; Thu, 28 Jan 2010 18:12:15 -0500 Received: from [199.232.76.173] (port=41597 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NadX1-0006GJ-4M for emacs-orgmode@gnu.org; Thu, 28 Jan 2010 18:12:11 -0500 Received: from mail-ew0-f224.google.com ([209.85.219.224]:54142) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NadX0-0005yc-9i for emacs-orgmode@gnu.org; Thu, 28 Jan 2010 18:12:10 -0500 Received: by mail-ew0-f224.google.com with SMTP id 24so1354714ewy.26 for ; Thu, 28 Jan 2010 15:12:10 -0800 (PST) In-Reply-To: <87eilaqli4.fsf@stats.ox.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Dan Davison Cc: emacs-orgmode@gnu.org On Jan 28, 2010, at 4:47 PM, Dan Davison wrote: > "Martin G. Skj=E6veland" writes: > >> Hi, >> >> I have two questions regarding org-babel-tangle and Makefile. >> >> Running org-babel-tangle on the following file >> >> ----------------------------------start >> * test >> >> #+begin_src makefile :tangle Makefile >> test: >> echo "hello" >> #+end_src >> ----------------------------------end >> > [...] >> When I use this makefile >> >> $make -f Makefile. test >> >> I get >> >> Makefile.:4: *** missing separator (did you mean TAB instead of 8 >> spaces?). Stop. >> >> even though I used TAB and not space when editing the Makefile =20 >> code. How >> can I avoid TABs being converted to space? > > Hi again Martin, > > This is more to do with org-mode sensu strictu (non-babel). When you > exit a code edit buffer, tabs are automatically converted to > spaces. There is an org-mode variable org-src-preserve-indentation =20 > which > already has a few different effects. Perhaps a solution is to add > not_removing_tabs to the effects of this variable, as in the patch > below. I can't think off hand what that's going to break -- anyone? > > Dan > > > =46rom d854544d24377434c2ace13aac45e85e42bcc7aa Mon Sep 17 00:00:00 = 2001 > From: Dan Davison > Date: Thu, 28 Jan 2010 10:36:29 -0500 > Subject: [PATCH] org-src: Don't remove tabs when org-src-preserve-=20 > indentation is non-nil > > --- > lisp/org-src.el | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/lisp/org-src.el b/lisp/org-src.el > index cdad99b..1d155cc 100644 > --- a/lisp/org-src.el > +++ b/lisp/org-src.el > @@ -525,7 +525,7 @@ the language, a switch telling if the content =20 > should be in a single line." > org-edit-src-content-indentation)) > (preserve-indentation org-src-preserve-indentation) > (delta 0) code line col indent) > - (untabify (point-min) (point-max)) > + (unless preserve-indentation (untabify (point-min) (point-max))) > (save-excursion > (goto-char (point-min)) > (if (looking-at "[ \t\n]*\n") (replace-match "")) > --=20 > 1.6.3.3 If you have an *indented* code block where the #+begin src is already =20= indented, this might mess up the relative indentation in the Org-mode =20= buffer because TAB can land on odd places in the line. But I can see that this is a problem =20= with Makefiles, so please apply the patch. Thanks - Carsten - Carsten