Reputation: 556
In org-mode (8.2.5) is there any way to export to ascii without line breaks being inserted at the end of every line in the .txt file?
A good canditate would have been:
(setq org-ascii-text-width nil)
But nil isn't accepted as an argument for org-ascii-text-width
.
An un-elegant work-around is:
(setq org-ascii-text-width 1000)
Assuming that none of my paragraphs are more that 1000 characters long.
If I:
(setq org-ascii-text-width 10000)
I get the error:
Stack overflow in regexp matcher
Upvotes: 7
Views: 1643
Reputation: 556
This is somewhat embarrassing:
Removing the org-ascii-text-width
-variable all together does what I need: no breaks are added when I export to ascii.
I started fiddling with org-ascii-text-width
when I noticed line breaks being added in exported text and I wrongly assumed it was due to an update to org 8.2.5.
The cause of this was something else. I must have inadvertently set fill-column
or something similar.
Upvotes: 1
Reputation: 5280
The misc-commands
package defines a function called goto-longest-line
. Using this function, we can define a function that sets org-ascii-text-width
to the length of the longest line in the current buffer:
(defun org-set-ascii-text-width ()
(save-excursion (setq org-ascii-text-width
(cadr (goto-longest-line (point-min) (point-max))))))
To make sure org-ascii-text-width
gets updated every time you save an org-mode
buffer, add it to before-save-hook
:
(add-hook 'before-save-hook
(lambda () (if (eq major-mode 'org-mode)
(org-set-ascii-text-width))))
misc-commands
is available in MELPA and can be package-install
ed (after adding MELPA to the list of package archives for the Emacs Package Manager).
If you don't want to install the package I guess you could also head over here, grab the goto-longest-line
function and add it to your .emacs
(along with a comment that mentions the original author, of course).
Upvotes: 2