emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sometimes we don't want org-src to remove tabs [WAS: Re: [Orgmode] t


From: Dan Davison
Subject: Re: sometimes we don't want org-src to remove tabs [WAS: Re: [Orgmode] tangle and Makefile]]
Date: Fri, 29 Jan 2010 10:28:08 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Carsten Dominik <address@hidden> writes:

> On Jan 28, 2010, at 4:47 PM, Dan Davison wrote:
>
>> "Martin G. Skjæveland" <address@hidden> 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
>>> 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
>> 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
>>
>>
>> From d854544d24377434c2ace13aac45e85e42bcc7aa Mon Sep 17 00:00:00 2001
>> From: Dan Davison <address@hidden>
>> Date: Thu, 28 Jan 2010 10:36:29 -0500
>> Subject: [PATCH] org-src: Don't remove tabs when org-src-preserve-
>> 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
>> 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 ""))
>> --
>> 1.6.3.3
>
> If you have an *indented* code block where the #+begin src is already
> indented, this might mess up the relative indentation in the Org-mode
> buffer because TAB can
> land on odd places in the line.  But I can see that this is a problem
> with Makefiles, so please apply the patch.

OK, applied.

Martin -- with the latest git version, and with
org-src-preserve-indentation set to a non-nil value, you should be able
to tangle makefiles correctly. Please let us know if not.

Dan

>
> Thanks
>
> - Carsten
>
>
> - Carsten
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

[Prev in Thread] Current Thread [Next in Thread]