emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org bb40848458 1/4: org-odt-plain-text: Fix stripping s


From: ELPA Syncer
Subject: [elpa] externals/org bb40848458 1/4: org-odt-plain-text: Fix stripping spaces around plain-text segments
Date: Wed, 26 Oct 2022 00:58:21 -0400 (EDT)

branch: externals/org
commit bb40848458512fc26ffa47d20807e3cd0211ccad
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-odt-plain-text: Fix stripping spaces around plain-text segments
    
    * lisp/ox-odt.el (org-odt-plain-text): Do not strip whitespace around
    individual plain-text objects.
    
    Reported-by: AndrĂ¡s Simonyi <andras.simonyi@gmail.com>
    Link: 
https://orgmode.org/list/CAOWRwxC2MTqAmXVXtLJi39f=KEC-6tmWJ6XC3OMTXqvC2hC_xw@mail.gmail.com
---
 lisp/ox-odt.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index df6cfed642..15a9cf2dec 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2920,13 +2920,21 @@ contextual information."
       ;; not be desired in scripts that do not separate words with
       ;; spaces (for example, Han script).  `fill-region' is able to
       ;; handle such situations.
+      ;; FIXME: The unnecessary spaced may still remain when a newline
+      ;; is at a boundary between Org objects (e.g. italics markup
+      ;; followed by newline).
       (setq output
             (with-temp-buffer
               (insert output)
-              ;; Unfill.
-              (let ((fill-column (point-max)))
-                (fill-region (point-min) (point-max)))
-              (buffer-string))))
+              (save-match-data
+                (let ((leading (and (string-match (rx bos (1+ blank)) output)
+                                    (match-string 0 output)))
+                      (trailing (and (string-match (rx (1+ blank) eos) output)
+                                     (match-string 0 output))))
+                  ;; Unfill, retaining leading/trailing space.
+                  (let ((fill-column (point-max)))
+                    (fill-region (point-min) (point-max)))
+                  (concat leading (buffer-string) trailing))))))
     ;; Return value.
     output))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]