[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Tabs in export of code
From: |
Charles C. Berry |
Subject: |
Re: [O] Tabs in export of code |
Date: |
Sun, 11 Jan 2015 18:05:36 -0800 |
User-agent: |
Alpine 2.00 (OSX 1167 2008-08-23) |
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