emacs-diffs
[Top][All Lists]
Advanced

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

emacs-27 f8607d3 2/2: Handle filling of indented ChangeLog function entr


From: Noam Postavsky
Subject: emacs-27 f8607d3 2/2: Handle filling of indented ChangeLog function entries
Date: Sat, 4 Apr 2020 20:28:35 -0400 (EDT)

branch: emacs-27
commit f8607d3c03544afbe32c6bd324c287db305e569e
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Handle filling of indented ChangeLog function entries
    
    * lisp/vc/log-edit.el (log-edit-fill-entry): Relax regexp a bit to
    recognize function entries with leading blanks.
    * test/lisp/vc/log-edit-tests.el: New test.
---
 lisp/vc/log-edit.el            |  2 +-
 test/lisp/vc/log-edit-tests.el | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index d5d4614..906f9a9 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -529,7 +529,7 @@ according to `fill-column'."
          (and (< beg end)
               (re-search-forward
                (concat "\\(?1:" change-log-unindented-file-names-re
-                       "\\)\\|^\\(?1:\\)(")
+                       "\\)\\|^\\(?1:\\)[[:blank:]]*(")
                end t)
               (copy-marker (match-end 1)))
          ;; Fill prose between log entries.
diff --git a/test/lisp/vc/log-edit-tests.el b/test/lisp/vc/log-edit-tests.el
index bb3f658..86a40a9 100644
--- a/test/lisp/vc/log-edit-tests.el
+++ b/test/lisp/vc/log-edit-tests.el
@@ -74,6 +74,31 @@ couple of sentences.  Long enough to be
 filled for several lines.
 \(fun9): Etc."))))
 
+(ert-deftest log-edit-fill-entry-indented-func-entries ()
+  ;; Indenting function entries is a typical mistake caused by using a
+  ;; misconfigured or non-ChangeLog specific fill function.
+  (with-temp-buffer
+    (insert "\
+* dir/file.ext (fun1):
+  (fun2):
+  (fun3):
+* file2.txt (fun4):
+  (fun5):
+  (fun6):
+  (fun7): Some prose.
+  (fun8): A longer description of a complicated change.\
+  Spread over a couple of sentences.\
+  Long enough to be filled for several lines.
+  (fun9): Etc.")
+    (goto-char (point-min))
+    (let ((fill-column 72)) (log-edit-fill-entry))
+    (should (equal (buffer-string) "\
+* dir/file.ext (fun1, fun2, fun3):
+* file2.txt (fun4, fun5, fun6, fun7): Some prose.
+\(fun8): A longer description of a complicated change.  Spread over a
+couple of sentences.  Long enough to be filled for several lines.
+\(fun9): Etc."))))
+
 (ert-deftest log-edit-fill-entry-trailing-prose ()
   (with-temp-buffer
     (insert "\



reply via email to

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