7

As simple as that. Everytime I export from orgmode to text the lines are wrapped. How to disable this?

Thank you,

E.

  • 2
    You may try exporting via ox-pandoc to plain text. Pandoc includes an --wrap=none command line option. – Juancho Aug 17 '17 at 20:00
2

John Kitchin initially wrote a simple program to do this. He then improved it and made it into ox-clip a org-mode based Emacs package, which is easy to get through Melpa's repository. Not only does it avoid wrapping text, it also preserves the format on the clipboard so that it is a breeze to paste.

ox-clip may need you to install a clipboard manager depending on your system. Specific installation instructions can be found here.

| improve this answer | |
  • I don't think this refers to the question, does it? :) My initial question was how to export without line wrapping (rather than copying and pasting formatted text outside Emacs). – Emmanuel Goldstein Apr 20 at 6:53
  • 1
    I thought it came close enough to the question and valuable enough to include it. 1) Using ox-clip to copy text actually eliminates all wrapping. It is a very easy way to export text if you want to paste it, say, in an e-mail. (But because it exports it as HTML code, it only works when you are pasting it in places that look for HTML code in the clipboard). 2) The function ox-clip-formatted-copy exports an org region to HTML and copies it to the clipboard. You need to then paste it where you need to export it. You may have had a more specific conception of exporting where this did not count. – SaMeji Apr 21 at 19:00
  • Thanks, I think that could work. I did not see the whole extent of the value in your answer. Thumbs up! – Emmanuel Goldstein Apr 25 at 6:18
2

Org-mode provides the customization variable org-ascii-text-width. If you set this to a large enough value, it has the effect of not wrapping text blocks during export to plain text.

However, doing this also does weird things to text that the exporter tries to present as centered titles and subtitles. That applies to the contents of #+TITLE: and #+AUTHOR: lines, and probably other similar options. You can turn these off via the customization variables org-export-with-title and org-export-with-author. I don't see any obvious way of modifying the title formatting in a way that wouldn't get mangled by long lines.

| improve this answer | |
0

Once in a while, I'm drafting e-mails in an orgmode buffer. I'd like to export the plain text, but without wrapped lines. Usually I forget to disable auto-fill-mode while writing.

So after finishing the text, I copy it into scratch, mark it and then: M-x replace-string Ctrl-q Ctrl-j Ctrl-q Ctrl-j RET XXXX RET. Result: Every new paragraph is replaced by XXXX.

Next step: M-x replace-string Ctrl-q Ctrl-j RET <space> RET : I'm replacing the single newlines with a singel space.

Next step: M-x replace-string XXX RET Ctrl-q Ctrl-j RET : I'm replacing the XXXX against the former new paragraphs.

Ready for copy and paste.


Edit:

After OP made a comment about the #+OPTIONS:, I found that you can write #+OPTIONS: \n:nil into the preamble of the org file, which is supposed to toggle whether to preserve line breaks (`org-export-preserve-breaks').

Then -- thanks to Tyler -- I customized org-ascii-text-width. Set it to 10000 and you don't get a line break. But unfortunately the exporter assumes the pagewidth were that large and pushes the sections and the title _far_far_ away.

| improve this answer | |
  • Exporting to text seems to impose hard wrapping, even if the source is not filled to begin with – Tyler Aug 17 '17 at 19:27
  • @Tyler Maybe, but I just copy and paste the »unwrapped« text. – Keks Dose Aug 17 '17 at 19:56
  • 1
    Actually, I found the answer: #+OPTIONS: :: (Toggle fixed-width sections ->>(org-export-with-fixed-width)) – Emmanuel Goldstein Aug 18 '17 at 10:02
  • @EmmanuelGoldstein Sounds good. What exactly is the text after #+OPTIONS? – Keks Dose Aug 18 '17 at 11:57
  • exactly two colons: ::, as I wrote above. – Emmanuel Goldstein Aug 19 '17 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.