Просмотр исходного кода

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>
Nicolas Goaziou 5 лет назад
Родитель
Сommit
91b2398293
2 измененных файлов с 10 добавлено и 2 удалено
  1. 1 2
      lisp/org.el
  2. 9 0
      testing/lisp/test-org.el

+ 1 - 2
lisp/org.el

@@ -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

+ 9 - 0
testing/lisp/test-org.el

@@ -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 ()