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
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With