0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-24 20:02:51 +00:00

Merge branch 'bugfix'

This commit is contained in:
Ihor Radchenko 2023-04-30 19:18:58 +02:00
commit 128742418b
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -2920,24 +2920,25 @@ contextual information."
;; FIXME: The unnecessary spacing 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
(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))))
(insert
(substring
output
(length leading)
(pcase (length trailing)
(0 nil)
(n (- n)))))
;; Unfill, retaining leading/trailing space.
(let ((fill-column most-positive-fixnum))
(fill-region (point-min) (point-max)))
(concat leading (buffer-string) trailing))))))
(when (org-string-nw-p output) ; blank string needs not to be re-filled
(setq output
(with-temp-buffer
(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))))
(insert
(substring
output
(length leading)
(pcase (length trailing)
(0 nil)
(n (- n)))))
;; Unfill, retaining leading/trailing space.
(let ((fill-column most-positive-fixnum))
(fill-region (point-min) (point-max)))
(concat leading (buffer-string) trailing)))))))
;; Return value.
output))