emacs-diffs
[Top][All Lists]
Advanced

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

master 5ecd35555e9: Fix c-ts-common filling


From: Yuan Fu
Subject: master 5ecd35555e9: Fix c-ts-common filling
Date: Sun, 4 Aug 2024 23:50:08 -0400 (EDT)

branch: master
commit 5ecd35555e9e20de9717f0184f58a15d8a2e68a3
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Fix c-ts-common filling
    
    * lisp/progmodes/c-ts-common.el:
    (c-ts-common--fill-block-comment): Exclude the last line from filling if
    it only has non-word characters like *=-.
    * test/lisp/progmodes/c-ts-mode-resources/filling.erts: Fir the
    multi-line test and add a single line test.
---
 lisp/progmodes/c-ts-common.el                        |  6 +++---
 test/lisp/progmodes/c-ts-mode-resources/filling.erts | 16 +++++++++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el
index 022d21e11a1..674623a5e61 100644
--- a/lisp/progmodes/c-ts-common.el
+++ b/lisp/progmodes/c-ts-common.el
@@ -186,9 +186,9 @@ comment."
       ;; filling region.
       (when (not end-marker)
         (goto-char end)
-        (when (looking-back (rx "*/") 2)
-          (backward-char 2)
-          (skip-syntax-backward "-")
+        (forward-line 0)
+        (when (looking-at (rx (* (or (syntax whitespace) "*" "=" "-"))
+                              "*/" eol))
           (setq end (point))))
 
       ;; Let `fill-paragraph' do its thing.
diff --git a/test/lisp/progmodes/c-ts-mode-resources/filling.erts 
b/test/lisp/progmodes/c-ts-mode-resources/filling.erts
index e58b8e91c90..5425519b3d7 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/filling.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/filling.erts
@@ -101,7 +101,7 @@ Name: Type 4
 =-=
 /*================================================================
  * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
- woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
+ * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
  woooomy woooomy woooomy woooomy woooomy
  * ================================================================*/
 =-=
@@ -112,6 +112,20 @@ Name: Type 4
  * ================================================================*/
 =-=-=
 
+Name: Type 4 Single-line
+
+=-=
+/*================================================================
+ * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy 
woooomy
+ * ================================================================*/
+=-=
+/*================================================================
+ * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
+ * woooomy woooomy
+ * ================================================================*/
+=-=-=
+
+
 Name: Type 5
 
 /* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy



reply via email to

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