From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Tabs in export of code Date: Sun, 11 Jan 2015 18:05:36 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAUO2-0006GA-0a for emacs-orgmode@gnu.org; Sun, 11 Jan 2015 21:05:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAUNw-0006HC-IE for emacs-orgmode@gnu.org; Sun, 11 Jan 2015 21:05:45 -0500 Received: from iport-bcv1-out.ucsd.edu ([132.239.0.119]:1885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAUNw-0006Gx-6b for emacs-orgmode@gnu.org; Sun, 11 Jan 2015 21:05:40 -0500 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: Giuseppe Lipari Cc: emacs-orgmode@gnu.org On Sun, 11 Jan 2015, Giuseppe Lipari wrote: > Dear all, > > I am preparing a set of slides with examples of java code. I am using the > beamer exporter, configured for using minted with the following options: > [snip] > > > Ok, now the problem.I want to export a slide with this snippet: > > > #+BEGIN_SRC java > class PrimeThread extends Thread { > long minPrime; > PrimeThread(long minPrime) { > this.minPrime = minPrime; > } > > public void run() { > // compute primes larger than minPrime > ... > } > } > ... > PrimeThread p = new PrimeThread(143); > p.start(); > #+END_SRC > > There is not tab in this snipper (I never use tabs in code, only spaces). > Unfortunately, when opening the tex file, I see that a tab has been > introduced whenever 8 consecutive spaces are found, in particular at line 4. > This happens deep down (in org-indent-line-to, I guess) and AFAICS you do not have an option to set to change this. But you can use a filter function to change the TABs to spaces. This seems to handle your case: #+BEGIN_SRC emacs-lisp (add-to-list 'org-export-filter-final-output-functions (lambda (x y z) (replace-regexp-in-string "\t" " " x nil t))) #+END_SRC If you want to only do this for src blocks, then use `org-export-filter-src-block-functions' instead. See (info "(org) Advanced configuration") under `Filters' for details. HTH, Chuck