emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem with exporting TAB key
@ 2012-04-05  2:10 Vladimir Lomov
  2012-04-05  4:13 ` Nick Dokos
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Lomov @ 2012-04-05  2:10 UTC (permalink / raw)
  To: emacs-orgmode

#+TITLE: Problem with exporting TAB key
#+AUTHOR: Vladimir Lomov

* How to make TAB key to be exported from ORG document?

Consider the following example:
#+name: ex1
#+BEGIN_SRC sh :exports code
sort -t "	" -k 3 -o file2 file1
sort -t "	" -k 3 -o file3 file
#+END_SRC

How I inserting the TAB key in example: for first line I use =C-q
C-I=, for second line I use =C-q TAB=, but in tangled file and in
exported HTML document it is NOT a TAB just spaces.

How to force export and tangle functions not to convert TAB to spaces?

* COMMENT

#+BEGIN_SRC sh :tangle ex.sh :shebang "#!/bin/bash" :noweb yes
<<ex1>>
#+END_SRC



---
WBR, Vladimir Lomov

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with exporting TAB key
  2012-04-05  2:10 Problem with exporting TAB key Vladimir Lomov
@ 2012-04-05  4:13 ` Nick Dokos
  2012-04-05  4:43   ` Vladimir Lomov
  2012-04-06  1:34   ` Vladimir Lomov
  0 siblings, 2 replies; 8+ messages in thread
From: Nick Dokos @ 2012-04-05  4:13 UTC (permalink / raw)
  To: Vladimir Lomov; +Cc: emacs-orgmode

Vladimir Lomov <lomov.vl@gmail.com> wrote:

> #+TITLE: Problem with exporting TAB key
> #+AUTHOR: Vladimir Lomov
> 
> * How to make TAB key to be exported from ORG document?
> 
> Consider the following example:
> #+name: ex1
> #+BEGIN_SRC sh :exports code
> sort -t "	" -k 3 -o file2 file1
> sort -t "	" -k 3 -o file3 file
> #+END_SRC
> 
> How I inserting the TAB key in example: for first line I use =C-q
> C-I=, for second line I use =C-q TAB=, but in tangled file and in
> exported HTML document it is NOT a TAB just spaces.
> 
> How to force export and tangle functions not to convert TAB to spaces?
> 

You can't: org-export-preprocess-string (in lisp/org-exp.el) contains a
call to untabify:

      (untabify (point-min) (point-max))

which converts tabs to spaces, no questions asked. I don't know why that
is, so maybe Bastien or Carsten can tell us the reason.

If you are feeling adventurous, you might want to try commenting out
that call and see what, if anything, breaks.

Nick

> * COMMENT
> 
> #+BEGIN_SRC sh :tangle ex.sh :shebang "#!/bin/bash" :noweb yes
> <<ex1>>
> #+END_SRC
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with exporting TAB key
  2012-04-05  4:13 ` Nick Dokos
@ 2012-04-05  4:43   ` Vladimir Lomov
  2012-04-05  5:01     ` Olaf Meeuwissen
  2012-04-06  1:34   ` Vladimir Lomov
  1 sibling, 1 reply; 8+ messages in thread
From: Vladimir Lomov @ 2012-04-05  4:43 UTC (permalink / raw)
  To: Nick Dokos; +Cc: Emacs Org Mode Discussion list

Hello,
** Nick Dokos [2012-04-05 00:13:10 -0400]:

> Vladimir Lomov <lomov.vl@gmail.com> wrote:

>> #+TITLE: Problem with exporting TAB key
>> #+AUTHOR: Vladimir Lomov

>> * How to make TAB key to be exported from ORG document?

>> Consider the following example:
>> #+name: ex1
>> #+BEGIN_SRC sh :exports code
>> sort -t "	" -k 3 -o file2 file1
>> sort -t "	" -k 3 -o file3 file
>> #+END_SRC

>> How I inserting the TAB key in example: for first line I use =C-q
>> C-I=, for second line I use =C-q TAB=, but in tangled file and in
>> exported HTML document it is NOT a TAB just spaces.

>> How to force export and tangle functions not to convert TAB to spaces?


> You can't: org-export-preprocess-string (in lisp/org-exp.el) contains a
> call to untabify:

>       (untabify (point-min) (point-max))

Now I understand why I get such results.

> which converts tabs to spaces, no questions asked. I don't know why that
> is, so maybe Bastien or Carsten can tell us the reason.

I would be glad to hear the reason.

> If you are feeling adventurous, you might want to try commenting out
> that call and see what, if anything, breaks.

I can do other thing: use another symbol to separate fields (I'm writing
a script using literate programming approach and ORG, so it is a matter
of taste what to use as separator), but I'll try your suggestion also.

> Nick

Thanks Nick.

>> * COMMENT

>> #+BEGIN_SRC sh :tangle ex.sh :shebang "#!/bin/bash" :noweb yes
>> <<ex1>>
>> #+END_SRC

P.S. I noticed that you send message to my e-mail directly and CC to
mailing list. Is it "good practice" or just a habit? I thought that
answering to ML only is enough.

---
WBR, Vladimir Lomov

-- 
Why use Windows, since there is a door?
(By fachat@galileo.rhein-neckar.de, Andre Fachat)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with exporting TAB key
  2012-04-05  4:43   ` Vladimir Lomov
@ 2012-04-05  5:01     ` Olaf Meeuwissen
  2012-04-05  5:27       ` Vladimir Lomov
  0 siblings, 1 reply; 8+ messages in thread
From: Olaf Meeuwissen @ 2012-04-05  5:01 UTC (permalink / raw)
  To: Vladimir Lomov; +Cc: Nick Dokos, Emacs Org Mode Discussion list

Vladimir Lomov <lomov.vl@gmail.com> writes:

> Hello,
> ** Nick Dokos [2012-04-05 00:13:10 -0400]:
>
>> Vladimir Lomov <lomov.vl@gmail.com> wrote:
>
>>> #+TITLE: Problem with exporting TAB key
>>> #+AUTHOR: Vladimir Lomov
>
>>> * How to make TAB key to be exported from ORG document?
>
>>> Consider the following example:
>>> #+name: ex1
>>> #+BEGIN_SRC sh :exports code
>>> sort -t "	" -k 3 -o file2 file1
>>> sort -t "	" -k 3 -o file3 file
>>> #+END_SRC
>
>>> How I inserting the TAB key in example: for first line I use =C-q
>>> C-I=, for second line I use =C-q TAB=, but in tangled file and in
>>> exported HTML document it is NOT a TAB just spaces.

Just a thought but can't you use "\t"?
-- 
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom
                 http://www.fsf.org/jf?referrer=1962

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with exporting TAB key
  2012-04-05  5:01     ` Olaf Meeuwissen
@ 2012-04-05  5:27       ` Vladimir Lomov
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir Lomov @ 2012-04-05  5:27 UTC (permalink / raw)
  To: Olaf Meeuwissen; +Cc: Emacs Org Mode Discussion list

Hello,
** Olaf Meeuwissen [2012-04-05 14:01:37 +0900]:

> Vladimir Lomov <lomov.vl@gmail.com> writes:

>> Hello,
>> ** Nick Dokos [2012-04-05 00:13:10 -0400]:

>>> Vladimir Lomov <lomov.vl@gmail.com> wrote:

>>>> #+TITLE: Problem with exporting TAB key
>>>> #+AUTHOR: Vladimir Lomov

>>>> * How to make TAB key to be exported from ORG document?

>>>> Consider the following example:
>>>> #+name: ex1
>>>> #+BEGIN_SRC sh :exports code
>>>> sort -t "	" -k 3 -o file2 file1
>>>> sort -t "	" -k 3 -o file3 file
>>>> #+END_SRC

>>>> How I inserting the TAB key in example: for first line I use =C-q
>>>> C-I=, for second line I use =C-q TAB=, but in tangled file and in
>>>> exported HTML document it is NOT a TAB just spaces.

> Just a thought but can't you use "\t"?

That would be to simple :D.

P.S. I wouldn't bother with <TAB> and ^I if "\t" just work, it is much
simple to type "\t" than ~C-q <TAB>~ or ~C-q ^I~, and portable.

$ sort --version
sort (GNU coreutils) 8.16
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and Paul Eggert.

---
WBR, Vladimir Lomov

-- 
Burnt Sienna.  That's the best thing that ever happened to Crayolas.
		-- Ken Weaver

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with exporting TAB key
  2012-04-05  4:13 ` Nick Dokos
  2012-04-05  4:43   ` Vladimir Lomov
@ 2012-04-06  1:34   ` Vladimir Lomov
  2012-04-06  9:11     ` Bastien
  1 sibling, 1 reply; 8+ messages in thread
From: Vladimir Lomov @ 2012-04-06  1:34 UTC (permalink / raw)
  To: Nick Dokos; +Cc: Emacs Org Mode Discussion list

Hello,
** Nick Dokos [2012-04-05 00:13:10 -0400]:

> Vladimir Lomov <lomov.vl@gmail.com> wrote:

>> #+TITLE: Problem with exporting TAB key
>> #+AUTHOR: Vladimir Lomov

>> * How to make TAB key to be exported from ORG document?

>> Consider the following example:
>> #+name: ex1
>> #+BEGIN_SRC sh :exports code
>> sort -t "	" -k 3 -o file2 file1
>> sort -t "	" -k 3 -o file3 file
>> #+END_SRC

>> How I inserting the TAB key in example: for first line I use =C-q
>> C-I=, for second line I use =C-q TAB=, but in tangled file and in
>> exported HTML document it is NOT a TAB just spaces.

>> How to force export and tangle functions not to convert TAB to spaces?


> You can't: org-export-preprocess-string (in lisp/org-exp.el) contains a
> call to untabify:

>       (untabify (point-min) (point-max))

> which converts tabs to spaces, no questions asked. I don't know why that
> is, so maybe Bastien or Carsten can tell us the reason.

> If you are feeling adventurous, you might want to try commenting out
> that call and see what, if anything, breaks.

Just tried, I commented that line in org-exp.el, run Emacs open ORG file
export it to HTML and tangle it. HTML document has spaces instead of TAB
as well as shell file.

If there is no other way to preserve TAB in tangled file (I only concern
with tanlged file) I will use another symbol to separate fields.

>> * COMMENT

>> #+BEGIN_SRC sh :tangle ex.sh :shebang "#!/bin/bash" :noweb yes
>> <<ex1>>
>> #+END_SRC

---
WBR, Vladimir Lomov

-- 
College:
	The fountains of knowledge, where everyone goes to drink.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with exporting TAB key
  2012-04-06  1:34   ` Vladimir Lomov
@ 2012-04-06  9:11     ` Bastien
  2012-04-06 14:03       ` Vladimir Lomov
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2012-04-06  9:11 UTC (permalink / raw)
  To: Vladimir Lomov; +Cc: Nick Dokos, Emacs Org Mode Discussion list

Hi Vladimir,

Vladimir Lomov <lomov.vl@gmail.com> writes:

> Just tried, I commented that line in org-exp.el, run Emacs open ORG file
> export it to HTML and tangle it. HTML document has spaces instead of TAB
> as well as shell file.

Can you try the change proposed by Nick in combination with 

(setq org-src-preserve-indentation t)

an report?

-- 
 Bastien

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with exporting TAB key
  2012-04-06  9:11     ` Bastien
@ 2012-04-06 14:03       ` Vladimir Lomov
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir Lomov @ 2012-04-06 14:03 UTC (permalink / raw)
  To: Bastien; +Cc: Nick Dokos, Emacs Org Mode Discussion list

Hello,
** Bastien [2012-04-06 11:11:00 +0200]:

> Hi Vladimir,

> Vladimir Lomov <lomov.vl@gmail.com> writes:

>> Just tried, I commented that line in org-exp.el, run Emacs open ORG file
>> export it to HTML and tangle it. HTML document has spaces instead of TAB
>> as well as shell file.

> Can you try the change proposed by Nick in combination with 

> (setq org-src-preserve-indentation t)

> an report?

Details:
1. I (temporary) removed org files distributed with Emacs;
2. Tried following combinations:
  A - commented  `untabify' line in `org-exp.el'
  B - run emacs with `org-src-preserve-indentation' set to `t'

not(A) & not(B) -> TAB is replaced with spaces in `ex2.sh'
    A  & not(B) -> TAB is replaced with spaces
not(A) & B      -> TAB remains in `ex2.sh'
    A  & B      -> TAB remains


I'm not sure if step 1 is required but I want to be sure that org files
which are in `/usr/share/emacs/site-package' to be used. I use package
manager of my distro (Archlinux) to install Emacs compiled from source
(bzr repo) and org package, taken from git repo (org files are installed to
`/usr/share/emacs/site-package/org{,_contrib}').

P.S. There is another issue with indentation: when using `C-c '' to edit
source block in appropriate major mode, then in case of shell one, it
adds extra two spaces at begin on any command. If
`org-src-preserve-indentation' is set to `t' that two spaces remains,
though it is not big problem.

---
WBR, Vladimir Lomov

-- 
Drinking coffee for instant relaxation?  That's like drinking alcohol for
instant motor skills.
		-- Marc Price

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-06 14:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-05  2:10 Problem with exporting TAB key Vladimir Lomov
2012-04-05  4:13 ` Nick Dokos
2012-04-05  4:43   ` Vladimir Lomov
2012-04-05  5:01     ` Olaf Meeuwissen
2012-04-05  5:27       ` Vladimir Lomov
2012-04-06  1:34   ` Vladimir Lomov
2012-04-06  9:11     ` Bastien
2012-04-06 14:03       ` Vladimir Lomov

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).