emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: "Martin G. Skjæveland" <martige@ifi.uio.no>
Cc: emacs-orgmode@gnu.org, Carsten Dominik <carsten.dominik@gmail.com>
Subject: sometimes we don't want org-src to remove tabs [WAS: Re: tangle and Makefile]]
Date: Thu, 28 Jan 2010 10:47:47 -0500	[thread overview]
Message-ID: <87eilaqli4.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <4B616C72.2000707@ifi.uio.no> ("Martin G. Skjæveland"'s message of "Thu, 28 Jan 2010 11:52:34 +0100")

"Martin G. Skjæveland" <martige@ifi.uio.no> 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 <davison@stats.ox.ac.uk>
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

  parent reply	other threads:[~2010-01-28 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-28 10:52 [babel] tangle and Makefile "Martin G. Skjæveland"
2010-01-28 15:38 ` Dan Davison
2010-01-28 17:00   ` Eric Schulte
2010-01-28 15:47 ` Dan Davison [this message]
2010-01-28 18:21   ` sometimes we don't want org-src to remove tabs [WAS: Re: tangle and Makefile]] Carsten Dominik
2010-01-29 15:28     ` Dan Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eilaqli4.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=martige@ifi.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).