Do not fill paragraph before region

* lisp/org.el (org-fill-paragraph): Do not fill paragraph before
region.
* testing/lisp/test-org.el (test-org/fill-paragraph): Add test.

Reported-by: Matt Lundin <mdl@imapmail.org>
<http://lists.gnu.org/r/emacs-orgmode/2020-07/msg00164.html>
This commit is contained in:
Nicolas Goaziou 2020-07-14 11:46:38 +02:00
parent fe41103d50
commit 91b2398293
2 changed files with 10 additions and 2 deletions

View File

@ -19375,8 +19375,7 @@ filling the current element."
(skip-chars-backward " \t\n")
(while (> (point) start)
(org-fill-element justify)
(org-backward-paragraph))
(org-fill-element justify))
(org-backward-paragraph)))
(goto-char origin)
(set-marker origin nil))))
(t

View File

@ -752,6 +752,15 @@
(push-mark (point) t t)
(goto-char (point-min))
(call-interactively #'org-fill-paragraph)
(buffer-string)))))
(should
(equal "012345678 9\n\n012345678\n9"
(org-test-with-temp-text "012345678 9\n<point>\n012345678 9"
(let ((fill-column 10))
(transient-mark-mode 1)
(push-mark (point) t t)
(goto-char (point-max))
(call-interactively #'org-fill-paragraph)
(buffer-string))))))
(ert-deftest test-org/auto-fill-function ()