emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Giuseppe Lipari <giulipari@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Tabs in export of code
Date: Sun, 11 Jan 2015 18:05:36 -0800	[thread overview]
Message-ID: <alpine.OSX.2.00.1501111753530.1188@charles-berrys-macbook.local> (raw)
In-Reply-To: <CABHo5SBxfUWnc6YhoRc7YGzv6USC=ho-p6eDROxMCqMMrJk4=g@mail.gmail.com>

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

      parent reply	other threads:[~2015-01-12  2:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-11 16:31 Tabs in export of code Giuseppe Lipari
2015-01-11 18:01 ` Eric S Fraga
2015-01-11 18:30   ` Giuseppe Lipari
2015-01-11 21:16     ` Grant Rettke
2015-01-12  2:05 ` Charles C. Berry [this message]

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=alpine.OSX.2.00.1501111753530.1188@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=giulipari@gmail.com \
    /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).