From 1b17e8c8da3b8edede1a34559fac0dfedbaf5e6c Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 20 Sep 2014 01:05:22 +0200 Subject: [PATCH] ox-ascii: Fix filling with preserve break * lisp/ox-ascii.el (org-ascii--fill-string): Allow filling even when `org-export-preserve-breaks' is non-nil. --- lisp/ox-ascii.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 4a6696e54..3695d5eba 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -423,17 +423,17 @@ equivalent to `left'. For a justification that doesn't also fill string, see `org-ascii--justify-string'. Return nil if S isn't a string." - ;; Don't fill paragraph when break should be preserved. - (cond ((not (stringp s)) nil) - ((plist-get info :preserve-breaks) s) - (t (let ((double-space-p sentence-end-double-space)) - (with-temp-buffer - (let ((fill-column text-width) - (use-hard-newlines t) - (sentence-end-double-space double-space-p)) - (insert s) - (fill-region (point-min) (point-max) justify)) - (buffer-string)))))) + (when (stringp s) + (let ((double-space-p sentence-end-double-space)) + (with-temp-buffer + (let ((fill-column text-width) + (use-hard-newlines t) + (sentence-end-double-space double-space-p)) + (insert (if (plist-get info :preserve-breaks) + (replace-regexp-in-string "\n" hard-newline s) + s)) + (fill-region (point-min) (point-max) justify)) + (buffer-string))))) (defun org-ascii--justify-string (s text-width how) "Justify string S. -- 2.11.4.GIT